为什么不能在此代码中使用.style.top = "200px";
?使用oclick="this.style.left='200px';"
在元素内调用事件也不起作用。为什么不是obj.style.left =“200px”;在这个代码中工作?
<html>
<head>
</head>
<body>
<div id="theDiv">The Div</div>
<button id="theButton">Do</button>
</body>
</body>
</html>
<script type="text/javascript">
document.getElementById("theButton").onclick = function(){
document.getElementById("theDiv").style.top = "200px";
};
</script>
什么'position'的设置为每个元素? – 2010-11-18 16:07:22