标签:style 定义 sed utf-8 har get pre elements ++
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style> li { list-style: none; width: 114px; height: 140px; background: url(img/normal.png); float: left; margin-right: 20px; } </style> <script> window.onload = function() { var oLi = document.getElementsByTagName(‘li‘); for(var i = 0; i < oLi.length; i++) { oLi[i].onOff = true; oLi[i].onclick = function() { if(this.onOff) { this.style.background = ‘url(img/active.png)‘; this.onOff = false; } else { this.style.background = ‘url(img/normal.png)‘; this.onOff = true; } } } } </script> </head> <body> <ul> <li></li> <li></li> <li></li> </ul> </body> </html>
标签:style 定义 sed utf-8 har get pre elements ++
原文地址:http://www.cnblogs.com/linjiaxiaomeiainia/p/6905352.html