473,772 Members | 2,510 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Submit Form by clicking on an image

Hi all

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

Thanks
Jul 19 '05 #1
4 2409
Use JavaScript code that will submit the form as a result of the click
event:

<html>
<head>

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

</head>
<body>

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

<img src="" onclick="Submit Form()">

</form>

</body>
"Ice Man" <eh***@hotmail. com> wrote in message
news:%2******** ********@TK2MSF TNGP11.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

"Elie Grouchko" <eg*******@hotm ail.com> wrote in message
news:OI******** ********@TK2MSF TNGP12.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.getEle mentById("form1 ").submit() ;
}
</script>

</head>
<body>

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

<img src="" onclick="Submit Form()">

</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******** ********@TK2MSF TNGP11.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
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*******@hotm ail.com> wrote in message
news:OI******** ********@TK2MSF TNGP12.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.getEle mentById("form1 ").submit() ;
}
</script>

</head>
<body>

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

<img src="" onclick="Submit Form()">

</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******** ********@TK2MSF TNGP11.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
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("s ubButton.x") OR
request.form("s ubButton.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******* ********@newsfe 5-gui.ntli.net...

"Elie Grouchko" <eg*******@hotm ail.com> wrote in message
news:OI******** ********@TK2MSF TNGP12.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.getEle mentById("form1 ").submit() ;
> }
> </script>
>
> </head>
> <body>
>
> <form id="form1" action="page2.h tm" method="post">
>
> <img src="" onclick="Submit Form()">
>
> </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******** ********@TK2MSF TNGP11.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
6049
by: Mark Michel | last post by:
Hi. I have made an html form which I would like to send by e-mail. When the recipient receives the e-mail form, I would like them to be able to fill it out and click the Submit button which will submit to an ASP page. This ASP page contains the code to submit the form data to a database. The page works fine when viewed through a browser, but the form will not submit in Outlook 2002 (I haven't tried other mail programs). Any...
2
1866
by: Matt | last post by:
The problem is I have 3 buttons that need to submit the form to different URL. My approach is to declare <input type="submit"> rather than <input type="button">. And put the following in the JavaScript: InputForm.action="URL LOCATION" InputForm.method="POST"; I think we don't need InputForm.submit(); because <input type="submit">.
4
10676
by: btopenworld | last post by:
I am submitting a form using an image as the link to a js file. The image calls a js function which checks fields- issuing alerts for errors - if no errors it then submits the form. I would like to have a final confirm box run from the function before the form is submitted. I guess I would have to use the return statement somehow but I can't see quite how. Any help gratefully accepted John
2
73382
by: Terence Parker | last post by:
How does one go about submitting a form with a link - but submitting it to a new window AND to a page different to that described within the action="" option of the <form> tag? Say, for example, I have a simple form such as the following: <form method="POST" action="submit.php" name="AForm"> Name: <input type="text" name="Name" length="20"><br> Age: 15 <a href="age.php">change age</a><br> <input type="submit" name="submit"...
6
3106
by: CJM | last post by:
Can somebody clarify if/how/when a simple form is submitted when the <Enter> key is pressed? As I understood it, if you have a form with a single submit button, if enter is pressed, the form should be submitted as if the button is pressed. Is this correct? Does this behaviour vary across browsers? Chris
2
3508
by: Matt | last post by:
In the following code, I have 2 questions regarding submit button with image. 1) Does this code <input type="image" name="populate" src="populate.gif"> behave the same as an HTML submit button with image populate.gif? When I click p1 or p2 button, it will post the page to process.asp. 2) When I check the checkbox, I want the image in submit button change from populate.gif to validate.gif. Unfortunately, the code InputForm.p2.src =...
1
2799
by: Matt | last post by:
The problem is I have 3 buttons that need to submit the form to different URL. My approach is to declare <input type="submit"> rather than <input type="button">. And put the following in the JavaScript: InputForm.action="URL LOCATION" InputForm.method="POST"; I think we don't need InputForm.submit(); because <input type="submit">.
6
1924
by: nikou_70 | last post by:
I have a page with image, image has some image map, I want to submit form when user mouseover that image map, my code is like this: <img src="Images/floor4.jpg"usemap="#planetmap" id="IMG1"> <map id="planetmap" name="planetmap"> <area id=f4 shape="circle" coords="65, 93, 11" alt="CF4588" onmouseover=overf4()>
1
2746
by: nikou_70 | last post by:
I have a page with image, image has some image map, I want to submit form when user mouseover that image map, my code is like this: <img src="Images/floor4.jpg"usemap="#planetmap" id="IMG1"> <map id="planetmap" name="planetmap"> <area id=f4 shape="circle" coords="65, 93, 11" alt="CF4588" onmouseover=overf4()> And I write sub overf4() in vb script
1
2656
by: Kirthikaiitm | last post by:
Hi, I have a image button (APPLY) On clicking apply button how to move the content from textbox to another textarea. I wrote the code in JScript. But once i click APPLY button the form is getting refreshed and the content in test area get vanished. How to retain the value on text area or how to avoid refreshing form on clicking image APPLY button.My button is <input type="image" src=/images/...> Pls. help regards, Kirthika
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10264
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9914
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6716
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4009
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3610
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2851
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.