标签:position span top abs tle type this htm event
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<input type="text" id="txt" onkeypress="num1(this.event)">
<hr/>
<script>
function num1(obj,ev){
if(ev.keyCode<48||ev.keyCode>57)
{
ev.preventDefault();
}
}
</script>
<span id="span1">跟随我</span>
<script>
window.document.body.onmousemove=function(){
var span1=document.getElementById(‘span1‘);
span1.style.position=‘absolude‘;
span1.style.left=event.clientX+‘px‘;
span1.style.top=event.clientY+‘px‘
}
</script>
</body>
</html>
标签:position span top abs tle type this htm event
原文地址:http://www.cnblogs.com/lyh15/p/6527198.html