Home > Web Front-end > JS Tutorial > Use Javscript to implement the all-select function of form check boxes_Form special effects

Use Javscript to implement the all-select function of form check boxes_Form special effects

WBOY
Release: 2016-05-16 19:13:07
Original
1228 people have browsed it

A relatively common select all function, I saw it when I was working on the backend the day before yesterday, and I sorted it out. Specific:
// Description: form1 is the form name, mId is the check box, selectbutton is the select all button


Check box:

Note: Note The name of the check box should correspond to the document.form1.mId in the above script

Select all button:  

Also note the name=selectButton <script> <BR> function selectAll() <BR> { <BR>for (var i=0;i<document.form1.mId.length;i++) { <BR>var temp=document.form1.mId[i]; <BR>temp.checked=!temp.checked; <BR>} <BR> if (document.form1.selectButton.value=="全部选择") <BR> { <BR> document.form1.selectButton.value="取消全选"; <BR> } <BR> else <BR> { <BR> document.form1.selectButton.value="全部选择"; <BR> } <BR>} <BR></script>

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template