标签:height offset var function set idt cti fse interval
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8">
<style type="text/css">
#dv1{
width: 300px;
height: 300px;
border: 1px solid;
background: red;
position: absolute;
}
</style>
</head>
<body>
<div id="dv1"></div>
<script type="text/javascript">
var dv1=document.getElementById(‘dv1‘);
dv1.onclick=function(){
var ss=dv1.offsetLeft;
setInterval(bb,1)
function bb(){if (ss<600) {
ss+=1;
dv1.style.left=ss+"px"
}}
}
</script>
</body>
</html>
标签:height offset var function set idt cti fse interval
原文地址:http://www.cnblogs.com/a8497336/p/6034715.html