469,569 Members | 1,566 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,569 developers. It's quick & easy.

How can you programatically submit a type image

if i have an Input type Image
how am i suppose to programatically submit it through JS.

code:

<INPUT type="text"
onkeyup="javascript:if(event.keyCode==13){btnClick .click();}">

<INPUT name="btnClick" type="Image" value="Button"
onclick="javascript:alert('button was clicked');">

clicking "btnClick" will raise the onclick event producing 'button was
clicked', but onkeyup of the textbox will not call the click() method

Im using Input type Image because that is what ASP.net produces for an
image button.

Jul 23 '05 #1
2 1498
In article <11**********************@g49g2000cwa.googlegroups .com>, jw56578
@gmail.com enlightened us with...
if i have an Input type Image
how am i suppose to programatically submit it through JS.


input type=image will automatically submit its form onclick.
<input type="image" name="whatever" src="myButton.gif" alt="submit">

No JS required.

The onclick is automatically script. Ditch the "javascript:".
onclick="somefunction();"

There is no such thing as submitting a button. If you want to submit the form
without clicking the button (from another form element handler), use
something like
onClick="this.form.submit();"

--
--
~kaeli~
When a clock is hungry, it goes back four seconds.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2
That was no help, thanks. But I changed from onkeyup to onkeydown and
it worked, so nevermind.

Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Nicolas Keller | last post: by
2 posts views Thread by Matt | last post: by
10 posts views Thread by The Natural Philosopher | last post: by
7 posts views Thread by Petr Vileta \(fidokomik\) | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.