爲什麼不能在此代碼中使用.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