Use a picture instead of a submit button for a form submission and reset button reset

Source: Internet
Author: User

1, with pictures instead of submitting button submit and reset button Reset, to the picture plus the onclick event

<script language= "JavaScript" >
function Fsubmit (obj) {
Obj.submit ();
}
function Freset (obj) {
Obj.reset ();
}
</script>
<form id= "Form1" Name= "Form1" method= "Post" action= "Login.asp" >
Name: <input type= "text" name= "TextField"/>


</form>

2, to 1 of the picture plus style, used to make up for the method 1 mouse moved to the picture no response, failed to give customers a good browsing experience

<script language= "JavaScript" >
function Fsubmit (obj) {
Obj.submit ();
}
function Freset (obj) {
Obj.reset ();
}
</script>
<form id= "Form1" Name= "Form1" method= "Post" action= "Login.asp" >
Name: <input type= "text" name= "TextField"/>


</form>

3, with pictures instead of submitting button submit and reset button Reset, and add links, the effect of the same 2

<script language= "JavaScript" >
function Fsubmit (obj) {
Obj.submit ();
}
function Freset (obj) {
Obj.reset ();
}
</script>
<form id= "Form1" Name= "Form1" method= "Post" action= "Login.asp" >
Name: <input type= "text" name= "TextField"/>
<a href= "Javascript:fsubmit (DOCUMENT.FORM1);" ></a>
<a href= "Javascript:freset (DOCUMENT.FORM1);" ></a>
</form>

4, the use of image fields. Because the default image fields are submitted by clicking on the form, the appropriate processing is done:

<script language= "JavaScript" >
function Fsubmit (obj) {
Obj.submit ();
}
function Freset (obj) {
Obj.reset ();
}
</script>
<form id= "Form1" Name= "Form1" method= "Post" action= "Login.asp" >
Name: <input type= "text" name= "TextField"/>
<input type= "image" Name= "ImageField" onclick= "Javascript:fsubmit (Document.form1); return false;" Src= "uploads/ 200707/30_145425_001.jpg ">
<input type= "image" Name= "ImageField2" onclick= "Javascript:freset (Document.form1); return false;" Src= "uploads/ 200707/30_145428_002.jpg ">
</form>

Note that the form submission and reset events in JS must be added (), such as Submit () and reset ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.