房天下 > 房天下问答 > 业主生活 > 其他
  • 可展开收起的一个DIV区域 if条件判断不了

    <html><head><title>可展开的一个DIV区域</title><meta http-equiv="content-Type" content="text/html;charset=gb2312"><style>#content,#intro,{font: 13px/25px;width: 200px;height: 400px;background: #eee;padding: 10px;border: 4px #ccc double;border-bottom:0;overflow: hidden;}#intro, {color: #036;font:12px; border: 4px #ccc double; border-top:0; height:70px;}#key{color:#900;float:right}hr{height:1px;border:1px #ccc dotted}</style></head><body><script>var s=50;var minheight=60;var maxheight=445;function shoppingcat(){ var key = document.getElementById("key"); if(key.SRC=="cate_open1.gif") //??为什么这个条件判断不了?{ content.style.pixelHeight+=s; if(content.style.pixelHeight<maxheight){ setTimeout("shoppingcat();",50); }else{ document.getElementById("key").src="cate_fold1.gif"; } }else{ content.style.pixelHeight-=s; if(content.style.pixelHeight>minheight){ setTimeout("shoppingcat();",50); }else{ document.getElementById("key").src="cate_open1.gif"; } }}</script><div id="content"> 一个站长:<br><br>当夜孤独的时候,<br> 还可以抱着你。<br>那该有多幸福……<br>一个适应寂寞的人,<br>只要有你陪着我,<br>忽略心中那美丽的温存……<br>当我寂寞的时候还可以想着你……<br><br>我想说:<br> 我是多么多么的爱你……<br>而你去什么也没感受到……<br></div><div id="intro"><hr>作者:乱言<img src="cate_fold1.gif" id="key" onClick="shoppingcat();"></div></body></html>

    提问者:妞黑虎

    发布于2011-01-18

共1个回答
  • ip我知道 丨Lv 4
    因为你的图片src不完整<script> function shoppingcat(){ var key = document.getElementById("key"); alert(key.src);}</script>你看看z真正的src是什么?附件:选择蛋糕.rar
    +10 2011-01-18 举报
热门人气推荐
免责声明:问答内容均来源于互联网用户,房天下对其内容不负责任,如有版权或其他问题可以联系房天下进行删除。