如何用Javascript控制div的位置?
发布网友
发布时间:2022-04-07 05:41
我来回答
共2个回答
热心网友
时间:2022-04-07 07:10
<div id="a">aaaaaaa</div>
<input type="button" onclick=moveto()>
function moveto(){
var e = document.getElementById("a");
e.style.position = "absolute";
e.style.left = "0px"
e.style.top = "0px"
}
热心网友
时间:2022-04-07 08:28
function moveto(){
var e = document.getElementbyId("div的ID");
e.style.position = "absolute";
e.style.left = "0px;"
e.style.top = "0px;"
}