<<  < 2016 - >  >>
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29




<!doctype html>
<html>
    <head>
<!--声明当前页面的编码集:中文编码(gbk/gb2312),国际编(utf-8)-->
< http-equiv="Content-Type" content="text/html" charset="utf-8">
    <!--声明当前页面的三要素-->
     <title>HTML国际标准化模板-柳翰林</title>
     < name="Keywords" content="美女,帅哥,女博士">
     < name="deion" content="描述信息">
     <style type="text/css">
*{margin:0;padding:0;}
/*
#box{width:100px;height:100px;background:pink;position:absolute;top:0;left:0;}
    */
 #photo{width:100px;height:100px;border-radius:50px;position:absolute;top:0;left:0;}
</style>

    </head>
<body>
<!--
<div id="box"></div>
-->
<img id="photo" src="http://www.tyblog.com/images/1.jpg" />
< type="text/***">
var x=0, y=0;
var speed =5;
var xtep = speed;
var ytep = speed;
var strDom = ***.getElementById("photo");
var maxwidth = innerWidth - strDom.offsetWidth;
var maxheight = innerHeight -strDom.offsetHeight;

dra(){
y+=ytep;
x+=xtep;
if(y>=maxheight){
 ytep=-speed;
 y=maxheight;
}

if(y<=0){
ytep=-speed;
y=0;
}


if(x>=maxwidth){
 xtep=speed;
 x=maxwidth;
}

if(x<=0){
xtep=speed;
x=0;
}
strDom.style.top=y+"px";
strDom.style.left=x+"px";
}



setInterval((){
dra();
},1000/10);
</>
</body>
</html>
  • 标签:Jquery JS 
  • 发表评论:
    天涯博客欢迎您!