If there is an <input type="image"> here, then pressing this image directly will submit the form. If there is OnSubmit, this function will be executed first. If it returns false, the form will not be submitted! Copy code The code is as follows:<span style="font-size:14px;"><script language=javascript> function test() { alert("Test!") } </script> <form name="F1" onSubmit="fuck();"> <input type="image" src="" width="51" height="20"> </form></span> Another example: Copy code The code is as follows:<html> </head> <script language="javascript"> function checkEmpty(form){ for(i=0;i<form.length;i++){ alert(form.elements[i].value); if( form.elements[i].value=="" ){ alert("Form information cannot be empty"); return false; } } } </script> <body> <form name="form" method="post" onSubmit="return checkEmpty(form)"> <input name="name" type="text" size="17"> <input name="password" type="password" size="17"> <input type="image" src="" width="51" height="20"> <input type="button" value="AAA" /> </form> </body> <html> |
<<: Summary of pitfalls of using nginx as a reverse proxy for grpc
>>: Several methods of implementing two fixed columns and one adaptive column in CSS
mapGetters Helper Function mapGetters helper func...
This article records the graphic tutorial of MySQ...
This article shares the specific code for JavaScr...
Usually in project development, we have to deal wi...
Record some of the places where you spent time on...
This article mainly introduces the sample code of...
MySQL supports many data types, and choosing the ...
Writing XHTML demands a clean HTML syntax. Writing...
Table of contents Lazy Loading CSS styles: HTML p...
This article describes how to add or expand a dis...
Table of contents 1. Basic use of css(): 1.1 Get ...
01. Command Overview The locate command is actual...
Note: This demo is tested in the mini program env...
This article shares the specific code for canvas ...
The topic I want to share with you today is: &quo...