本帖最后由 王梁星 于 2012-10-29 22:43 编辑
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <title></title>
- <script type="text/javascript" >
- function showCom()
- {
- var dtNode=event.srcElement;
- var dlNode=dtNode.parentNode;
- if(dlNode.className=="open")
- {
- dlNode.className="close";
- }
- else
- {
- dlNode.className="open";
- }
- }
- </script>
- <style type="text/css">
- .close{
- height: 30px;
- overflow: hidden;
- }
- .open{
- height: 30px;
- overflow: visible;
- }
- </style>
- </head>
- <body>
- <dl>
- <dt onclick="showCom()">fdsfdsf</dt>
- <dd>fhgfhgfhtr</dd>
- <dd>fhgfhgfhtr</dd>
- <dd>fhgfhgfhtr</dd>
- <dd>fhgfhgfhtr</dd>
- </dl>
- <dl>
- <dt onclick="showCom()">fdsfdsf</dt>
- <dd>fhgfhgfhtr</dd>
- <dd>fhgfhgfhtr</dd>
- <dd>fhgfhgfhtr</dd>
- <dd>fhgfhgfhtr</dd>
- </dl>
- <dl>
- <dt onclick="showCom()">fdsfdsf</dt>
- <dd>fhgfhgfhtr</dd>
- <dd>fhgfhgfhtr</dd>
- <dd>fhgfhgfhtr</dd>
- <dd>fhgfhgfhtr</dd>
- </dl>
- </body>
- </html>
- 请诸位在自己电脑上试试,此html代码,是否可用。linux里,event未定义,是不是event是windows独有的对象?不过windows没成功阿。。求解
复制代码 |