trycss_position_top 在线代码实例
<img src="/upload2/attachments/cover/cover_css.png" width="95" height="84" id="img">
<div>
<input type="text" value="0" id="num">
<button id="change">更改top值</button>
<h1>This is a heading</h1>
</div>
<script>
var img = document.getElementById('img');
var num = document.getElementById('num');
var btn = document.getElementById('change');
btn.onclick = function () {
img.style.top = num.value + 'px';
}
</script>