472,141 Members | 1,373 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,141 software developers and data experts.

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.


<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 1591
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:".

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

When a clock is hungry, it goes back four seconds.

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 leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.