A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 糖伯貓 中级黑马   /  2014-1-20 10:20  /  1147 人查看  /  2 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>无标题文档</title>
  6. <style>
  7.         .open{
  8.                 overflow: visible;
  9.         }
  10.         .close{
  11.                 overflow: hidden;
  12.        
  13.         }
  14.         dl{
  15.                 overflow: hidden;
  16.                 height: 16px;
  17.         }

  18. </style>
  19. <script>
  20.         function changeSize (size) {
  21.                 var divobj = document.getElementById("divid");
  22.                 divobj.style.fontSize = size;
  23.         }

  24.         function list (node) {
  25.                 var nodes = node.parentNode;
  26.                
  27.                 if (nodes.className == "open") {
  28.                         nodes.className = "close";
  29.                 }else
  30.                 nodes.className = "open";
  31.                
  32.         }
  33. </script>
  34. </head>

  35. <body>
  36.                 <a href="javascript:void(0)" onclick="changeSize("24px")">大</a>
  37.                 <a href="javascript:void(0)" onclick="changeSize("16px")">中</a>
  38.                 <a href="javascript:void(0)" onclick="changeSize("9px")">小</a><br/>
  39.                
  40.         <div id = "divid">

  41.                 是等覅水井坊款到即发两居室空间发<br/>
  42.                 是等覅水井坊款到即发两居室空间发<br/>
  43.                 是等覅水井坊款到即发两居室空间发<br/>
  44.                 是等覅水井坊款到即发两居室空间发<br/>
  45.                 是等覅水井坊款到即发两居室空间发<br/>
  46.                 是等覅水井坊款到即发两居室空间发<br/>
  47.                 是等覅水井坊款到即发两居室空间发<br/>
  48.         </div>

  49.         <dl>
  50.                         <dt onclick="list(this)">是低价房打开附件</dt>
  51.                         <dd>youxiang</dd>
  52.                         <dd>youxiang</dd>
  53.                         <dd>youxiang</dd>       
  54.                 </dl>
  55. </body>

  56. </html>
复制代码

2 个回复

倒序浏览
本帖最后由 落木萧萧 于 2014-1-20 11:18 编辑

39、40、41行语法有错误。
应该是
  1. <a href="javascript:void(0)" onclick="changeSize('24px')">大</a>
  2. <a href="javascript:void(0)" onclick="changeSize('16px')">中</a>
  3. <a href="javascript:void(0)" onclick="changeSize('9px')">小</a><br/>
复制代码

函数里应该是单引号。
话说这个用IE的F12一下就能看出来错误行。
回复 使用道具 举报
落木萧萧 发表于 2014-1-20 11:16
39、40、41行语法有错误。
应该是
函数里应该是单引号。

果然,汗 我用的谷歌 没反应:L
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马