Html Page 移动图片


html:

<img src=image.jpg id='imageid'   style="position:absolute; left: 0; top: 0;">

js: 

var x=document.getElementById('imageid').offsetTop;
x= x + step;
document.getElementById('imageid').style.top= x + "px";

 

getElementById 有效

document.getElementById('imageid')

  

querySelector 无效:

document.querySelector('img')

  

 

posted @ 2023-10-09 06:37  物华天宝关耳  阅读(32)  评论(0)    收藏  举报