By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,701 Members | 1,970 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,701 IT Pros & Developers. It's quick & easy.

Submit Form by clicking on an image

P: n/a
Hi all

How Can I submit a form by clicking on an image instead of the submit
button?

Thanks
Jul 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Use JavaScript code that will submit the form as a result of the click
event:

<html>
<head>

<script type="text/javascript">
function SubmitForm()
{
document.getElementById("form1").submit();
}
</script>

</head>
<body>

<form id="form1" action="page2.htm" method="post">

<img src="" onclick="SubmitForm()">

</form>

</body>
"Ice Man" <eh***@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi all

How Can I submit a form by clicking on an image instead of the submit
button?

Thanks

Jul 19 '05 #2

P: n/a

"Elie Grouchko" <eg*******@hotmail.com> wrote in message
news:OI****************@TK2MSFTNGP12.phx.gbl...
Use JavaScript code that will submit the form as a result of the click
event:

<html>
<head>

<script type="text/javascript">
function SubmitForm()
{
document.getElementById("form1").submit();
}
</script>

</head>
<body>

<form id="form1" action="page2.htm" method="post">

<img src="" onclick="SubmitForm()">

</form>

</body>

Why don't you just use:

<input type="image" src="image.jpg" alt="Submit" height="50" width="50" />

Then the form will submit for JS user and non JS users alike.....BTW, how
long has ASP been clientsize javascript?

:o/

"Ice Man" <eh***@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi all

How Can I submit a form by clicking on an image instead of the submit
button?

Thanks


Jul 19 '05 #3

P: n/a
I don't know actually how long but it helps a lot...
"Stuart Palmer" <st**************@ntlworld.com> wrote in message
news:83***************@newsfe5-gui.ntli.net...

"Elie Grouchko" <eg*******@hotmail.com> wrote in message
news:OI****************@TK2MSFTNGP12.phx.gbl...
Use JavaScript code that will submit the form as a result of the click
event:

<html>
<head>

<script type="text/javascript">
function SubmitForm()
{
document.getElementById("form1").submit();
}
</script>

</head>
<body>

<form id="form1" action="page2.htm" method="post">

<img src="" onclick="SubmitForm()">

</form>

</body>


Why don't you just use:

<input type="image" src="image.jpg" alt="Submit" height="50" width="50" />

Then the form will submit for JS user and non JS users alike.....BTW, how
long has ASP been clientsize javascript?

:o/

"Ice Man" <eh***@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi all

How Can I submit a form by clicking on an image instead of the submit
button?

Thanks



Jul 19 '05 #4

P: n/a
BTR
The image actually works like a submit button when using

<input type="image" name="subButton" src="image.jpg" alt="Submit"
height="50" width="50" />

getting the value from the submit button is
request.form("subButton.x") OR
request.form("subButton.y")

Because the button is an image - you are esentially testing to see if
the x,y value (height, width) is greater than 0

Hope this help
- Bastard
On Fri, 23 Jul 2004 17:25:24 +0200, "Ice Man" <eh***@hotmail.com>
wrote:
I don't know actually how long but it helps a lot...
"Stuart Palmer" <st**************@ntlworld.com> wrote in message
news:83***************@newsfe5-gui.ntli.net...

"Elie Grouchko" <eg*******@hotmail.com> wrote in message
news:OI****************@TK2MSFTNGP12.phx.gbl...
> Use JavaScript code that will submit the form as a result of the click
> event:
>
> <html>
> <head>
>
> <script type="text/javascript">
> function SubmitForm()
> {
> document.getElementById("form1").submit();
> }
> </script>
>
> </head>
> <body>
>
> <form id="form1" action="page2.htm" method="post">
>
> <img src="" onclick="SubmitForm()">
>
> </form>
>
> </body>
>


Why don't you just use:

<input type="image" src="image.jpg" alt="Submit" height="50" width="50" />

Then the form will submit for JS user and non JS users alike.....BTW, how
long has ASP been clientsize javascript?

:o/
>
> "Ice Man" <eh***@hotmail.com> wrote in message
> news:%2****************@TK2MSFTNGP11.phx.gbl...
> > Hi all
> >
> > How Can I submit a form by clicking on an image instead of the submit
> > button?
> >
> > Thanks
> >
> >
>
>



Jul 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.