用javascript 控制表格行的展开和隐藏的代码_javascript技巧 2020年6月30日 13:18:08js教程评论462 views阅读模式 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title> <script language="javascript" type="text/javascript"> function $(obj) { return document.getElementById(obj); } function close_open() { if($("myTr").currentStyle.display == "none") { $("myTr").style.display = ""; } else { $("myTr").style.display = "none"; } } </script> </head> <body> <table> <tr onclick="close_open()"><td>1<td></tr> <tbody id="myTr"> <tr><td>2<td></tr> <tr><td>3<td></tr> </tbody> </table> </body> </html> [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行] 点赞 登录收藏 https://www.qieseo.com/383743.html 复制链接 复制链接