Today in the implementation of CheckBox selection, reverse, and cancel JavaScript small script, always appear after clicking the page immediately refresh, select the checkbox all cancel the problem, debug a half-day, only to find that the original is <button> The reason for less write a type attribute in the label, depressed Ah, hope oneself later less commit this special 2 mistake, hereby record.
Copy Code code as follows:
<!--The following is the--> of the wrong wording
<button name= "Checkall" value= "class=" "Checkbutton" onclick= "Checkall" (form_favor,status) "> All selected </button >
Copy Code code as follows:
<!--correct wording-->
<button name= "Checkall" type= "button" value= "Select All" class= "Checkbutton" onclick= "Checkall (form_favor,status)" > select All </button>
Read the description of the Web, instantly understand, in the case of no type attribute, when the browser defaults to it when the submit processing, and I form accept the processing of the script is still empty, so it produced a "refresh" phenomenon!