Method 1: Add directly to the button
After you click submit, the submit button becomes unavailable, which effectively prevents repeated submission. This Code implements this function. From the code, we can see that we only need to add this sentence on the submit button: onclick = "javascript: {this. disabled = true; document. form1.submit ();} ", which means that when the button is clicked, the unavailable attribute of the button is set to true, and the button becomes grayed out.
<Html> <pead> <meta http-equiv = "Content-Type" content = "text/html; charset = gb2312 "> <title> the button turns gray after the form is submitted </title> </pead> <body> </ptml>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
Method 2: Use the onSubmit event and change the dimmed button to available.
Add the onSubmit event to the form. If the form is added with judgment, this method can be used directly. Remember to put it to the end; otherwise, it will be grayed out from the beginning, however, we added a code to make the submit button available,
This prevents repeated submission of information, and prevents code issues from leading to non-submission.
Copy codeThe Code is as follows:
<Form name = form1 action = "" onSubmit = "return closebut ()">
<Input name = "imageField" type = "submit" class = "inputbut" value = "OK"/> <br>
<Input type = "button" name = "hui" id = "hui" value = "make the submit button available" onclick = "document. form1.imageField. disabled = false"/>
</Form>
<Script>
Function closebut (){
Document. form1.imageField. disabled = true;
}
</Script>
Third, similar
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ptml xmlns = "http://www.w3.org/1999/xhtml"> <pead> <meta http-equiv =" content-type "content =" text/html; charset = gb2312 "> <meta name =" keywords "content =" webmaster, webpage special effects, js special effects, js scripts, scripts, ad code "/> <meta name =" description "content =" www.jb51.net, webmasters special effect network, webmasters must js special effects and ad code. A large number of high-quality js special effects, providing high-quality AD code downloads, all in the webmaster special effect network "/> <title> after the webpage special effect form is submitted, the button changes to the gray effect 3 </title> </pead> <body> script home, webmasters must provide high-quality webpage special effects and advertisement code. </Body> </ptml>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]