1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
| <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style type="text/css"> *{ margin: 0; padding: 0; } ul{ list-style: none; width: 500px; height: 40px; margin: 30px auto; display: flex; justify-content: space-around; cursor: pointer; } .active{ background-color: salmon; color: gold; font-size: 20px; border-bottom: aqua 5px solid; } li{ transition: all .3s linear; } .shadow{ box-shadow: 0 0 10px 10px skyblue; } </style> </head> <body> <ul> <li class="active shadow">新闻</li> <li class="shadow">娱乐</li> <li class="shadow">国际</li> <li class="shadow">军事</li> <li class="shadow">汽车</li> <li class="shadow">生活</li> </ul> </body> </html> <script type="text/javascript"> var stu={ num:1, name:"王二狗子", sex:"男", age:18, hobby:["琴","棋","书","画"], run:function(){ document.write("哈撒给<br />"); } }; document.write(stu+"<br />"); document.write(stu.name+"<br />"); document.write(stu["name"]+"<br />"); stu.phone=123456789; document.write(stu.phone+"<br />"); stu.name="王二麻子"; document.write(stu.name+"<br />"); for(var i=0;i<stu.hobby.length;i++){ document.write(stu.hobby[i]+"<br />"); } stu.run(); var liArray=document.getElementsByTagName("li"); for (var i=0;i<liArray.length;i++) { liArray[i].index=i; document.write(liArray[i].index+"<br />"); liArray[i].onclick=function(){ document.write(this.index); } } </script>
|