document.getElementById('div1').style.width=100
document.getElementById('div1').style.height=100
document.getElementById('div1').style.height=100
解决方案 »
- 诡异的事:undefined的是哪来的?
- 请问:怎样在IE里面调试javascript代码,有好的工具或者插件吗? 谢谢!
- 谁有TreeView(扩充XMLSelTree)里面例子的code
- 怎样把相同的对象触发相同的函数?
- 如何做出一个适用于IE,NETSCAPE,MOZILA三大浏览器所使用的右击菜单
- 梅花雪的 Combo box 下拉输入框 Beta 版
- 谁有比较漂亮点的javascript时间控件
- 啊。。写了一天了。。ASP和DHTML结合的远程调用的简化,仿WebService做的。
- 如何让setInterval延时的时间不一样?
- npm 安装模块安装不了,淘宝镜像也不行,求帮忙。。
- 怎么样得到一个字符串的某个部分的内容啊?
- javascript难道自己连画个圆圈都不行吗?一定要用 VML吗?
XXX.style.Height='100'
document.all("xxx").style.height="120";
2、可以赋值数字或字符串,比如=12和="12"和="12px"相同,还可以="80%"
document.getElementById('div1').offsetHeight
document.all.item("my_layer_name").height = 100;
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head><body>
<div id="Layer1"></div>
<script language="JavaScript">
if(Layer1.style.width==0 || Layer1.style.height==0)
{
Layer1.style.width=100;
Layer1.style.height=100;
alert(Layer1.style.width + "/" + Layer1.style.height);
}
else alert(Layer1.style.width + "/" + Layer1.style.height);
</script>
</body>
</html>
alert("div width is:"+document.all("层的名称").style.width);
alert("div height is:"+document.all("层的名称").style.height);
</script>