[Javascript] HELP: USING AN IMAGE FOR THE SUBMIT BUTTON ON A .JS FORM

Rodney Myers rmyers at i-way.co.uk
Fri Mar 30 01:43:22 CST 2001


Steven,

You don't tell us what the form does when it submits and its method, but
from what you say about the coords being a problem it sounds like you
are sunbmitting to a server script(?)

using type=image, I would usually have

rather than your
<input type="image" onClick="PickURL()" src="images/searchbutton.gif">

<input type="image" src="images/searchbutton.gif">
and
<form onSubmit="PickURL()" ... >
or more probably
<form onSubmit="return(PickURL(this))" ... >
so that the form object is passed to the function and a true/false
return value controls whether the actual submit takes place. If there is
no server action I would generally have
<form onSubmit="PickURL(this);return(false)" ... >

So <input type="image" src=".."> will submit the form. If the coords are
a problem then try using an image link. As this is not part of the form
object you have to specify the form object explicitly, and use the
form's submit() method:
<a href="javascript:window.document.FORMNAME.submit()"><img src=".."
...></a>

hth

Rodney

Steven Pesant wrote:
 
> Hopefully someone out here can provide a little assistance.  I've built a
> <FORM> that makes use of Javascript.  Rather than just using a default
> SUBMIT button, I need to make use of an IMAGE for the submit button.
> 
> When I use a default SUBMIT button everything works perfectly, but as soon
> as I change to an IMAGE for the SUBMIT button, the coordinates of where the
> user clicks on the image are added to the URL and it fails.

> My submit code looks like:
> <input type="image" onClick="PickURL()" src="images/searchbutton.gif">



-- 
Shop at ssistant Add-ons and Developer Workshops
http://www.aflyingstart.net/addons/
STILL PLACES OPEN on Fri 27 April workshop

Courses in April 
Mon 23  : Making a Start in E-Commerce with Shop at ssistant
Tue 24  : Meeting Business Needs with the Shop at ssistant Classic system
Wed 25 : Building Better Shopping Pages with Shop at ssistant Classic


Booking for these Shop at ssistant Classic courses at 
http://www.shopassistant.net/training/  
Or call 01256 880770

Rodney Myers
Based in Oxford, England
Technical Director, Shop at ssistant eCommerce Solutions




More information about the Javascript mailing list