Web front end of the day to learn a little JS Knowledge phase II

Source: Internet
Author: User

Code Broadcast point:

PS: Picture yourself Change OH

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title> Untitled Document </title>
<style type= "Text/css" >
. ul1{margin:20px 0px;}
. Ul1.before,.ul1.after{display:table;content: "";}
. Ul1.after{clear:both}
. UL1 li{width:100px;list-style:none;float:left;border:1px solid #000; margin-right:10px;}
img{width:100px;height:100px;}
</style>

<body>
<p> which elf do you like? </p>
<input type= "button" value= "Select All"/>
<input type= "button" value= "Deselect All"/>
<ul class= "UL1" >
<li><input type= "checkbox" name= "Check"/><span> kite 10 percent paper </span> </li>
<li><input type= "checkbox" name= "Check"/><span> when Saitama III </span> </span></li>
<li><input type= "checkbox" name= "Check"/><span> Wuhe piano </span> </li>
<li><input type= "checkbox" name= "check"/><span> Night knife God 10 incense </span ></li>
<li><input type= "checkbox" name= "check"/><span> eating cat fish </span> </li>
</ul>
<script>
var abtn = document.getelementsbytagname ("input");
Abtn[0].onclick = function () {
for (Var i=0;i<abtn.length;i++) {
Abtn[i].checked = true;
}
}
Abtn[1].onclick = function () {
for (Var i=0;i<abtn.length;i++) {
abtn[i].checked = false;
}
}
</script>
</body>

Web front end of the day to learn a little JS Knowledge phase II

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.