English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Hi,

Im trying to get it so that when a user clicks an image it submits the form.

Here is my syntax:

width="75" height="28" onclick="document.form.submit()" style="cursor:pointer" style="cursor:hand">


But for some reason its not working, whats wrong? I know the form works with a regular submit btn.

2007-08-25 11:16:47 · 3 answers · asked by jeff lemon 1 in Computers & Internet Programming & Design

3 answers

the solution you're looking for is the following.



It will act as submit within the form context

2007-08-25 11:26:30 · answer #1 · answered by cstruter 2 · 3 0

Your code is trunked, unfortunately... and we do not have your form call: we don't know the method you are using...

action = 'targetfilename.ext' method = 'POST'>
onclick = 'js_exit_sess(); return false;'>

1. You only need the "onclick()" if you want to do something before submitting the form. The form is submitted as you click the image.
2. If you need to use onclick as you do, use
document . formS [ 'formname' ] . submit();
(spaces added for clarity)

2007-08-25 21:16:53 · answer #2 · answered by just "JR" 7 · 0 0

Try using

2007-08-25 11:29:10 · answer #3 · answered by thinkunix 4 · 0 2

fedest.com, questions and answers