1. Use images instead of submit buttons
When there is only one submit button, it can be easily implemented without adding an event function. The code is:
Except for changing the label to input type="image", other attributes are the same as those of the label It's the same.
2. Replace all form buttons with images:
The image code format to replace the submit button is
The code image format that replaces the reset button is
Note: The formName here is the name attribute value of the form.
3. Form submission verification:
<script><br> function CheckDate(){<br> //Get the input data <br> userName = document.RedForm.userName.value;<br> userEmail = document.RedForm.userEmail.value;<br> //If no name is entered<br>if (userName=="") {<br>alert("Please enter your name");<br>document.RedForm. userName.focus();<br> return false;<br>}else{<br> //If no email is entered, or the email address is wrong (does not contain @)<br>if ((userEmail=="")| |(userEmail.indexOf("@")==-1)) {alert("Please re-enter your email address");<br>document.RedForm.userEmail.focus();<br>return false;<br> }else return true;<br>}<br>}<br> </script>
4. Use any element to submit the form:
Submit the form through onClick="document.form.submit();"; use onClick="document.form.reset();" to reset the form, this way Now, any element can implement form submission.