Body 对象代表文档的主体 (HTML body)
<!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8" /> <title></title> <script language="javascript"> function dealclick() { if (b1.innerText == "+") { list1.style.display = "block"; b1.innerText = "-"; } else { list1.style.display = "none"; b1.innerText = "+"; } } </script> </head> <body> <span id="b1" style="border:thin ridge;cursor:hand" onclick="dealclick()">-</span>list1<br> <ul id="list1"> <li>item1</li> <li>item2</li> <li>item3</li> </ul> list2 </body> </html>
点击list1后
时间: 2024-10-08 08:25:36