网站首页站长博客下载中心域名交易站长论坛域名主机免费电邮免费域名中文排行排名查询站长书库书籍教程下载
设为首页
加入收藏
总编信箱
投稿或申请专栏请先 [登 陆]
学院首页 网络编程 网页设计 图形图象 数 据 库 服 务 器 网络媒体 网络安全 个人专栏 站长CLUB 业界新闻 信息公告
 当前位置:首页 >> 网页设计 >> 网页特效 >> 正文
公告通知
返回上级列表
资料搜索
相关文章
随鼠标的闪烁小星星
[ 来源:中国站长学院 | 作者:风未起时 | 时间:2005-4-8 9:31:08 | 浏览:人次 ]
收藏到新浪ViVi 收藏到365KEY 收藏到我摘  字号选择〖    〗/ 双击滚屏 单击停止  

把如下代码加入<body>区域中
<script language="JavaScript">
<!--
colours=new Array('#ffffff','#ff0000','#00ff00','#ffffff','#ff00ff','#ffa500','#fff000','#0000ff','#ffffff')

y = 0;
x = 0;
n6=(document.getElementById&&!document.all);
ns=(document.layers);
ie=(document.all);
d=(ns||ie)?'document.':'document.getElementById("';
a=(ns||n6)?'':'all.';
n6r=(n6)?'")':'';
s=(ns)?'':'.style';
n=(n6)?9:10;
if (ns){
for (i = 0; i < n; i++)
document.write('<layer name="dots'+i+'" top=0 left=0 width='+i/2+' height='+i/2+' bgcolor=#ff0000></layer>');
}
if (ie)
document.write('<div id="con" style="position:absolute;top:0px;left:0px"><div style="position:relative">');
if (ie||n6){
for (i = 0; i < n; i++)
document.write('<div id="dots'+i+'" style="position:absolute;top:0px;left:0px;width:'+i/2+'px;height:'+i/2+'px;background:#ff0000;font-size:'+i/2+'"></div>');
}
if (ie)
document.write('</div></div>');

 


(ns||n6)?window.captureEvents(Event.MOUSEMOVE):0;
function Mouse(evnt){
y = (ns||n6)?evnt.pageY+4 - window.pageYOffset:event.y+4;
x = (ns||n6)?evnt.pageX+1:event.x+1;
}
(ns)?window.onMouseMove=Mouse:document.onmousemove=Mouse;

function animate(){
h=(ns||n6)?window.innerHeight:document.body.clientHeight;
w=(ns||n6)?window.innerWidth:document.body.clientWidth;

o=(ns||n6)?window.pageYOffset:0;
if (ie)con.style.top=document.body.scrollTop;
for (i = 0; i < n; i++){
var temp1 = eval(d+a+"dots"+i+n6r+s);
var randcolours = Math.floor(Math.random()*colours.length);
(ns)?temp1.bgColor = colours[randcolours]:temp1.background = colours[randcolours];
if (i < n-1){
 var temp2 = eval(d+a+"dots"+(i+1)+n6r+s);
 temp1.top = parseInt(temp2.top);
 temp1.left = parseInt(temp2.left);
 }
else{
 temp1.top = y+o;
 temp1.left = x;
 }
if ((y < h/10) || (y > h-h/10) || (x < w/10) || (x > w-w/10)){
var temp3 = eval(d+a+"dots"+0+n6r+s);
temp3.top = (y-25)+Math.random()*50;
temp3.left = (x-25)+Math.random()*50;
temp2.top = parseInt(temp3.top)+o;
temp2.left = parseInt(temp3.left);
}
}
setTimeout("animate()",30);
}
animate();
// -->
</script>


[发送给好友]  [打印本页]  [关闭窗口]  [返回顶部]   转载请注明来源:http://edu.chinaz.com   
特别声明: 本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。
栏目编辑: 设计风 责任编辑: 设计风
原始作者: 风未起时 录入时间: 2005-4-8 9:31:08
信息来源: 中国站长学院 投稿信箱: Edu#chinaz.com
设为首页 - 加入收藏 - 关于我们 - 广告服务 - 版权申明 - 友情链接 - 联系方式 - 总编信箱 - 会员投稿