Programming challenges
Now take advantage of the JavaScript knowledge that we've learned before, to implement the effect of tab switching.
:
Text Material:
Property:
2.75 million purchase Changping Neighborhood Triathlon Total Price 200,000 buy a home
2 million within the five rings of the three 1.4 million home to the east third ring
Beijing 0 First pay property 530,000 buy East 5 ring 50 Ping
Beijing real estate straight down 5000 Citic House Park house Wang existing
Home:
40 Flat rental house big makeover beauty girl's mixed up small nest
Classic Fresh Jean Home 90 flat old room glow Renaissance
New Chinese cool color warmth 66 flat contrast lively home
Tiles are like choosing a wife. Design of the flue in the bathroom
Secondary:
Tongzhou Luxury 3 2,600,002 ring scarce 2 250w Dump
West 3-Ring permeability 2 29,001,300,002-bedroom Limited
Yellow Cheng Gen Primary School District only 2,600,121 Ping 700,000 throw!
Exclusive villa 2.8 million Suzhou Bridge 2 special price 2.48 million
My answers
<! DOCTYPE html>/*CSS style creation*/body, UL, Li, a, ol{margin:0; padding:0; } a{Text-Decoration:none; Color: #000; } li{List-Style:none; }. header{Overflow:hidden; width:350px; }. Header li{float: Left; Margin-left:10px; Text-Align:center; Line-height:30px; width:98px; height:30px; border:1px Solid #888; Border-Bottom:none; }. Header. active{Border-top:2px solid #8B4513; Background-color: #fff; }. Header Li a{display:block; height:30px; width:98px; } #content ul{border:1px solid #7396B8; Border-top:2px solid #8B4513; padding:10px; width:380px; height:110px; position:relative; Top:-2px; Z-index:-1; }. notshow{Display:none; } </style> <script type= "Text/javascript" >//JS Implementation tab ToggleWindow.onload=function () { varHeader = document.getElementById ("header"); varLilist = Header.getelementsbytagname ("li"); for(vari=0;i<lilist.length;i++) {Lilist[i].index=i; Lilist[i].onclick=function () { varContent = document.getElementById ("Content"); varUlist = Content.getelementsbytagname ("ul"); for(vark=0;k<lilist.length;k++) {Lilist[k].setattribute ("Class", "" "); Ulist[k].setattribute ("Class", "Notshow"); } This. SetAttribute ("Class", "active"); ulist[ This. Index].setattribute ("Class", "" "); } } } </script>Programming challenges JavaScript Advanced (MU Class network topic)