Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: image to call function


Message #1 by stephen.peterson@m... on Thu, 17 Jan 2002 12:22:02 -0500
that worked! i was using it as an input and causing it to submit. i didn't
quite get that it was to call the function but without submitting the form. 

thanks alex,
steve




-----Original Message-----
From: Alex Bienz(viplondon) [mailto:alex@v...]
Sent: Thursday, January 17, 2002 12:27 PM
To: javascript
Subject: [javascript] RE: image to call function


are you using an image as an input type?
eg. <input type="image" name="myimage" srv="myimage.gif">
this image will work exactly the same way as a submit button and perhaps is
why form data is being passed,

using <img src="myimage.gif"> with an onClick event should not send any form
data through and works exactly the same way as a href

Alternatively you could place your image inside an anchor tag eg.

<a href="mypage.htm"><img src="myimage"></a>

and this should work too pluss give you a little hand symbol when the mouse
cursor moves over the image.

Hope this helps

		Cheers,
			Alex.

> -----Original Message-----
> From: stephen.peterson@m...
> [mailto:stephen.peterson@m...]
> Sent: 17 January, 2002 5:22 PM
> To: javascript
> Subject: [javascript] image to call function
>
>
> i'm trying to modify a script
> (http://javascriptkit.com/script/cut183.shtml)
> it is a double combo box navigation script. the left  select is named
> example andthe right is called stage2. (one of stage2s
> options is called
> program)
>
> i want to use an image instead of a button to call a
> function. the problem
> is that if i use the button i get the desired effect (a change to the
> windows location). when i use an image to call the function i
> get form info
> passed by the get method  to the url and a refresh. i end up with the
> location i am at with
> ?example=program&stage2=%3A%2F%2Fwww.foo.ca
>
> any help understanding how image vs button interact with
> forms would be
> appreciated.
>
> thanks
> s
>
>
> $subst('Email.Unsub').
>



  Return to Index