<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
div {
width: 100px;
height: 50px;
margin: 10px;
background: red;
}
</style>
<script type="text/javascript">
window.onload = function() {
var odiv = document.getElementsByTagName("div");
for (var i = 0; i < odiv.length; i++) {
odiv[i].timer = null;
odiv[i].onmouseover = function (){
start(this, 400)
}
odiv[i].onmouseout = function() {
start(this, 100)
}
}
function start(obj, wd) {
clearInterval(obj.timer)
obj.timer = setInterval(function() {
var speed = (wd - obj.offsetWidth) / 6
speed = speed > 0 ? Math.ceil(speed) : Math.floor(speed);
if (obj.offsetWidth==wd) {
clearInterval(obj.timer);
} else {
obj.style.width = obj.offsetWidth + speed + "px"
}
})
}
}
</script>
<script type="text/javascript">
</script>
</head>
<body>
<div id=""></div>
<div id=""></div>
<div id=""></div>
</div>
</body>
</html>
柠檬酸钠
相关分类