なぜこのコードで.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'年代どのようなものでなければなりません
left
またはtop
スタイルを使用するには? –