<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>走马灯原理</title>
<style type="text/css">
#container
{
position:relative;
margin:0 auto;
width:200px;
height:200px;
background:#0000cc;
}
#child
{
position:absolute;
top:200px;
left:0;
width:200px;
height:220px;
background:#FF0000;
}
#btnControl
{
position:absolute;
left:100px;
top:100px;
width:80px;
height:50px;
}
</style>
<script type="text/jscript">
function step(){
var child=document.getElementById("child");
var new_top=child.style.top.match(/([0-9,.\-]+)px/)[1]-5;
child.style.top=new_top+"px";
}
</script>
</head>
<body>
<div id="container">
<div id="child"></div>
</div>
<input type="button" id="btnControl" value="滚动" οnclick="step()" />
</body>
</html>
三个错误:
1、——————————————————————————————————————
2、——————————————————————————————————————
3、——————————————————————————————————————