用上一章节js写的,没有效果,哪里错了。
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>挑战题</title> </head> <script type="text/javascript"> function onclick(){ var bb=document.getElementById("xx") var cc=document.getElementsByTagName("li") if(bb.innerHTML=="更多") { bb.innerHTML="简化" cc[0].style.display="block" cc[1].style.display="block"} else(bb.innerHTML=="简化") { bb.innerHTML="更多" cc[0].style.display="none" cc[1].style.display="none" } } </script> <body> <ul> <li style="display:none">1</li> <li style="display:none">2</li> <li>3</li> <li>4</li> <li>5</li> <li>6</li> <li>7</li> <a href="#" id="xx" onclick="onclick()">更多</a> </ul> </body> </html>
要怎样改,学着后面忘着前面,好无语啊