以文本方式查看主题

-  ╋艺 镇╋  (http://wdystv.com/bbs/index.asp)
--  ┣◇网站建设&Web语言  (http://wdystv.com/bbs/list.asp?boardid=4)
----  css expression的问题  (http://wdystv.com/bbs/dispbbs.asp?boardid=4&id=3388)

--  作者:admin
--  发布时间:2012/3/5 11:55:08
--  css expression的问题

请教下 我这个div怎么写的不正常显示啊?

<div id="Ibuttom" style="position: absolute; top: expression(parseInt(document.getElementById("Idata").style.height)-20+"px"); width: 100%; height: 20px; background-color: #7F7F7F;"></div>

 

完整的代码是

 

<div id="Idata" style="position: absolute; left: 240px; top: 100px; width: 512px; height: 480px; background-color: #000000;">
      <div id="Itop" align="center" style="position: absolute; width: 100%; height: 20px; background-color: #7F7F7F;"></div>
      <div id="Ibuttom" style="position: absolute; top: expression(parseInt(document.getElementById("Idata").style.height)-20)px; width: 100%; height: 20px; background-color: #7F7F7F;"></div>
      <div id="Icanvas" style="position: absolute; left: 32px; top: 32px; width: 416px; height: 416px; background-color: #000000;">

      </div>
    </div>



---------------------------------

Ibuttom这个div是在Idata里面的,你在里面取外面的高度当然取不到了

 

<div id="Idata" style="position: absolute; left: 240px; top: 100px; width: 512px; height: 480px; background-color: #000000;">
      <div id="Itop" align="center" style="position: absolute; width: 100%; height: 20px; background-color: #7F7F7F;"></div>
      <div id="Ibuttom" style="position: absolute;width: 100%; height: 20px; background-color: #7F7F7F;"></div>
      <div id="Icanvas" style="position: absolute; left: 32px; top: 32px; width: 416px; height: 416px; background-color: #000000;">

      </div>
    </div>

<script type="text/javascript">

document.getElementById("Ibuttom").style.top=(document.getElementById("Idata").clientHeight-20)+"px";

</script>



http://wenwen.soso.com/z/q151061779.htm