百度空间 | 百度首页 
 
查看文章
 
网页特效:一个在页面上蠕动的怪圈
2006-07-13 12:16

<HTML>
<HEAD>
<META http-equiv='Content-Type' content='text/html; charset=gb2312'>
<TITLE>一个在页面上蠕动的怪圈,可以变换一下颜色,效果会好许多</TITLE>
</HEAD>
<BODY bgcolor=#000000>

<script language=JavaScript>

if (document.all){
with (document){
write('<div id="starsDiv" style="position:absolute;top:0px;left:0px">')
str = '<div style="position:relative;width:XXpx;height:XXpx;background:#ffffff;font-size:XXpx;visibility:visible"></div>'
re = /XX/g;// 创建正则表达式模式?
str1=str.replace(re,"1")
str2=str.replace(re,"2")
str3=str.replace(re,"3")
for (j=0;j<2;j++)
{
 for (i=0;i<14;i++)
 write(str1)

 for (i=0;i<9;i++)
 write(str2)
}
write(str3)
write('</div>')
}
}

if (document.layers)

var yBase = 10;
var xBase = 10;
var step = 0.5;
var currStep = 0;
var Xpos = 520;
var Ypos = 250;

if (document.all)
{
  function MoveHandler(){
  Xpos = document.body.scrollLeft+event.x;
  Ypos = document.body.scrollTop+event.y;
  }
                ;
}

else if (document.layers)
{
  function xMoveHandler(evnt){
  Xpos = evnt.pageX;
  Ypos = evnt.pageY;
  }
  window.onMouseMove = xMoveHandler;
}

function animateLogo() {
if (document.all)
{
 yBase = window.document.body.offsetHeight/6;
 xBase = window.document.body.offsetWidth/6;
}
else if (document.layers)
{
 yBase = window.innerHeight/8;
 xBase = window.innerWidth/8;
}

if (document.all)
{
 for ( i = 0 ; i < starsDiv.all.length ; i++ )
 {
  starsDiv.all[i].style.top = Ypos + yBase*Math.sin((currStep + i*4)/12)*Math.cos(400+currStep/200);
 starsDiv.all[i].style.left = Xpos + xBase*Math.sin((currStep + i*3)/10)*Math.sin(currStep/200);
 }
}

else if (document.layers)
{
 for ( j = 0 ; j < 14 ; j++ ) //number of NS layers!
 {
  var templayer="a"+j
  document.layers[templayer].top = Ypos + yBase*Math.sin((currStep + j*4)/12)*Math.cos(400+currStep/200);
  document.layers[templayer].left = Xpos + xBase*Math.sin((currStep + j*3)/10)*Math.sin(currStep/200);
 }
}
currStep+= step;
setTimeout("animateLogo()", 10);
}
animateLogo();
</script>

</BODY></HTML>


类别:网页制作 | | 添加到搜藏 | 分享到i贴吧 | 浏览() | 评论 (0)
 
最近读者:
 
网友评论:
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
验证码: 请点击后输入四位验证码,字母不区分大小写
      

     

©2010 Baidu