1, a few days received a wonderful demand, that is, when the mouse wheel sliding, div to hover, so this caused my knowledge of JavaScript review
First start with the type of the most basic variable
<! DOCTYPE html> null); </script>
The above alert will show true
2, select all, all do not select and anti-select feel personal really is not on the code has to rely on, feel if can not knock the code is really good grade, so in the future want to go home to help mom buy goods, feel can
It's better to earn money by mouth than to be strong.
<! DOCTYPE html>Football<input type= "checkbox" name= "items" value= "basketball" >Basketball<input type= "checkbox" name= "Items" value= "Volleyball" >Volleyball<input type= "checkbox" name= "Items" value= "Tan Yu" >Tan Yu<br/> <input type= "button" id= "Checkall" value= "Select All" > <input type= "button" id= "Nocheckall" value= "All not selected "> <input type=" button "id=" Oppositeall "value=" reverse select "> <script type=" Text/javascript ">varCheckbutton = document.getElementById ("Checkall"); Checkbutton.onclick=function() { varItems = Document.getelementsbyname ("Items"); for(vari = 0; i < items.length; i++) { if(!items[i].checked) {items[i].checked=true; } } } varNocheckbutton = document.getElementById ("Nocheckall"); Nocheckbutton.onclick=function() { varITEMS2 = Document.getelementsbyname ("Items"); for(vari = 0; i < items2.length; i++) { if(items2[i].checked) {items2[i].checked=false; } } } varOppcheckbutton = document.getElementById ("Oppositeall"); Oppcheckbutton.onclick=function() { varITEMS3 = Document.getelementsbyname ("Items"); for(vari = 0; i < items3.length; i++) { if(items3[i].checked) {items3[i].checked=false; } Else{items3[i].checked=true; } } } </script></body>3. Click Close, click Open
<! DOCTYPE html>div {display:none;} A {background-Color:orange;}. Open {Display:block;}. Close {display:none;} p{Font:bolder; Font-family:cursive; Font-Style:italic; Color:blue; Background-Color:orange;} Table, TR, TD {padding:0px;}</style><script type= "Text/javascript" >functionOpendiv (a) {varCurrentdiv = A.parentnode.getelementsbytagname ("div") [0]; varDIVs = document.getElementsByTagName ("div"); for(vari = 0; i < divs.length; i++) { if(Currentdiv = =Divs[i]) {Currentdiv.classname= "Open"; } Else{divs[i].classname= "Close"; } } }</script>The results of the code run are as follows
19. JavaScript Basics