<ul id="item"> <li>option1</li> <li>option2</li> <li>option3</li> </ul> <script type="text/javascript"> window.onload = function practise(){ var item = document.getElementById("item"); var links = item.getElementsByTagName("li"); for(var i=0; i<links.length; i++){ links[i].onclick = function(){ links[i].style.display = "none"; } } } </script>
相关分类