<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>js动画</title>
</head>
<body>
<p id="message">这是一个会动页面</p>
<img src="images/1-13062FT026.jpg" alt="MY Image" title="My Image" />
<script src="script/window.addLoadEvent.js" ></script>
<script src="script/js动画.js"></script>
<script src="script/js动画1.js"></script>
</body>
</html>function addLoadEvent(func){
var oldonload=window.onload;
if(typeof window.onload!='function'){
window.onload=func;
}else{
window.onload=function(){
func();
}
}
}function moveElement(ElemenId,final_x,final_y,interval){
if(!document.getElementById)return false;
if(!document.getElementById(ElemenId))return false;
var elem=document.getElementById(ElemenId);
var xpos=parseInt(elem.style.left);
var ypos=parseInt(elem.style.top);
if(xpos==final_x && ypos==final_y){
return true;
}
if(xpos<final_x){
xpos++;
}
if(xpos>final_x){
xpos--;
}
if(ypos<final_y){
ypos++;
}
if(ypos>final_y){
ypos--;
}
elem.style.left=xpos+"px";
elem.style.top=ypos+"px";
var repeat="moveElement('"+ElemenId+"',"+final_x+","+final_y+","+interval+")";
movement=setTimeout(repeat,interval);
}
addLoadEvent(positionMessage);
function positionMessage(){
if(!document.getElementById)return false;
if(!document.getElementById("message"))return false;
var elem=document.getElementById("message");
elem.style.position="absolute";
elem.style.left="50px";
elem.style.top="100px";
moveElement=("message",125,110,20);
}真找不到问题所在,bug在哪里?
添加回答
举报
0/150
提交
取消