如何获取一个元素的某个样式 alert(document.getElementById("floatTest").style.top);显示为空白 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <div id="floatTest" style="top:10px"></div>要直接写在家 style里才会有写在 css样式里是没有的 w3cwindow.getComputedStyle(要计算的元素对象,null).marginLeftdocument.defaultView.getComputedStyle(要计算的元素对象,null).marginLeftIE:id.currentStyle["marginLeft"]对象.currentStyle["marginLeft"] http://archive.cnblogs.com/a/1977076/ <html> <head> <title>document.getSeletion方法</title> </head> <body> <div id="floatTest" style="top: 10px"></div> <script type="text/javascript"> alert(document.getElementById('floatTest').style.top) </script> </body></html>这样可以啊 jquery问题 求用jquery写点击一个按钮弹出一个对话框可以保存 求解释 [Ext-JS]服务器端返回JSON数据,客户端如何解 请问右上角那个关闭按钮的背后是什么? pobj.appendChild(obj)问题 菜鸟求一验证函数 小问题: 如何清空文本框中内容,并得到焦点 JS动态计算合计值 Ext 直接请求action 怎么配置? 怎样用javascript在一个页面控制另一个页面的元素
要直接写在家 style里才会有写在 css样式里是没有的
window.getComputedStyle(要计算的元素对象,null).marginLeft
document.defaultView.getComputedStyle(要计算的元素对象,null).marginLeftIE:
id.currentStyle["marginLeft"]
对象.currentStyle["marginLeft"]
<head>
<title>document.getSeletion方法</title>
</head>
<body>
<div id="floatTest" style="top: 10px"></div>
<script type="text/javascript">
alert(document.getElementById('floatTest').style.top)
</script>
</body>
</html>
这样可以啊