#tech {
position: absolute;
border: 2px solid blue;
width: 30px;
height: 30px;
top: 50px;
}
<div id='tech'></div>
我是用的getComputedStyle(document.getElementById('tech'), null).top来取的top的值,但是这个好像是只读的,如果我要修改的话,应该怎么改?用document.getElementById('tech').top好像不行。CSSJavaScript
position: absolute;
border: 2px solid blue;
width: 30px;
height: 30px;
top: 50px;
}
<div id='tech'></div>
我是用的getComputedStyle(document.getElementById('tech'), null).top来取的top的值,但是这个好像是只读的,如果我要修改的话,应该怎么改?用document.getElementById('tech').top好像不行。CSSJavaScript
<style>
.a{
position: absolute;
border: 2px solid blue;
width: 30px;
height: 30px;
top: 50px;
}
</style>
<div id='tech' class="a"></div>
<script type="text/javascript">
var d=document.getElementById('tech');
d.style.top='500px';
</script>
document.getEelementById("").class="class1";
or
document.getEelementById("").class="class2";
or
document.getEelementById("").className="class2";
上面给错了