·用户注册
·用户登陆
·用户中心
首页
+
网络学院
+
网页特效
+
实用工具
+
网络资源
+
字体下载
+
娱乐世界
+
时尚前沿
+
图片中心
+
动漫天地
+
金石社区
图形
-
网页设计
-
优化
-
动易
-
动网
-
HTML
-
PSD
-
FLASH模板
-
插件
-
杀毒
-
系统工具
-
FLASH音乐
-
FLASH游戏
-
美女
您现在的位置:
金石网
>>
网页特效
>>
页面背景
>> 特效正文
星空背景,就像是遨游在宇宙中一样
『 更新时间:2006-4-1 』『 字体:
变小
变大
』『 作者:未知 | 来源:网络 』
把如下代码加入<body>区域中: 要完成此效果需要两个步骤 第一步:把如下代码加入到<head>区域中 <style type="text/css"> .star { position:absolute; layer-background-color:white; visibility:visible; top:-50px; width:50px; height:50px; font-size:1px; background-color:white; } .60pt{font-size:60pt;color:#ff66cc;font-family:汉鼎繁淡古} </style> <SCRIPT LANGUAGE="JavaScript"> <!-- var starnum = 75; // 星星的数目 var isNS = (document.layers); var _all = (isNS)? '' : 'all.'; var _style = (isNS) ? '' : '.style'; var xoffset, yoffset, w_x, w_y, tmpx, tmpy, scrlx, scrly; function getstartpos(obj) { //定义星星移动的起始位置 obj.deltay = Math.floor(Math.random() * 12); //用随机函数决定 obj.deltax = Math.floor(Math.random() * 12); obj.xdir = (Math.floor(Math.random() * 2) == 1) ? '+' : '-'; obj.ydir = (Math.floor(Math.random() * 2) == 1) ? '+' : '-'; obj.counter = 1; if (isNS) { obj.clip.width = 1; obj.clip.height = 1; obj.moveTo(xoffset+pageXOffset, yoffset+pageYOffset); }else { obj.width = 1; obj.height = 1; obj.pixelTop = yoffset+document.body.scrollTop; obj.pixelLeft = xoffset+document.body.scrollLeft; } } function movestar(starN) //移动星星的位置 { tmpx = starN.deltax*starN.counter+starN.counter; tmpy = starN.deltay*starN.counter+starN.counter; if (isNS) { starN.clip.width = starN.counter / 3; starN.clip.height = starN.counter / 3; scrlx = pageXOffset; scrly = pageYOffset; if((starN.left+tmpx >= w_x+scrlx) || (starN.top+tmpy >= w_y+scrly) || (starN.left-tmpx <= scrlx) ||(starN.top-tmpy <= scrly)) { getstartpos(starN); } else { eval('starN.moveBy('+starN.xdir+tmpx+','+starN.ydir+tmpy+')'); } } else { starN.width = starN.counter/3; starN.height =starN.counter/3; scrlx = document.body.scrollLeft; scrly = document.body.scrollTop; if((starN.pixelLeft+tmpx >= w_x+scrlx)||(starN.pixelTop+tmpy >= w_y+scrly) || (starN.pixelLeft-tmpx<= scrlx)||(starN.pixelTop-tmpy <= scrly)) { getstartpos(starN); } else { eval('starN.pixelTop'+starN.ydir+'=tmpy'); eval('starN.pixelLeft'+starN.xdir+'=tmpx'); } } starN.counter++; } function animate() //让所有的星星动起来 { for(i=1; i <= starnum; i++) { movestar(eval('star'+i)); } setTimeout('animate()', 100); } function findwindowparams() { //定义星星移动的起始位置 w_x = (isNS) ? window.innerWidth : document.body.clientWidth; w_y = (isNS) ? window.innerHeight : document.body.clientHeight; xoffset = w_x / 2; yoffset = w_y / 2; for (i =1; i <= starnum; i++) { getstartpos(eval('star'+i)); } } function resizeNS() { setTimeout('document.location.reload()', 400); } (isNS) ? window.onresize = resizeNS :window.onresize = findwindowparams; window.onload = new Function("findwindowparams();animate();"); --> </script> 第二步:把如下代码加入到<body>区域中 <SCRIPT LANGUAGE="JavaScript"> <!-- for (i = 1; i <= starnum; i++) { //给星星定义层 document.writeln('<div id="star'+i+'" class="star"></div>'); eval('varstar'+i+'=document.'+_all+'star'+i+_style); } --> </SCRIPT>
【点击数:】【
发表评论
】【
加入收藏
】【
告诉好友
】【
打印此文
】【
关闭窗口
】
相
关文章
您的姓名:
评分等级:
1分
2分
3分
4分
5分
评论内容:
1、严禁发表危害国家安全、政治、黄色淫秽等内容的评论。
2、用户需对自己在使用金石网服务过程中的行为承担法律责任。
3、本站管理员有权保留或删除评论内容。
4、评论内容只代表网友个人观点,与本网站立场无关。
没有相关特效
网
友评论
|
设为首页
|
加入收藏
|
联系我们
|
版权申明
|
友情链接
|
站点地图
|
网站帮助
|
网站留言
|
广告服务
|
Copyright © 2001-2008
K
ings
N
et.biz All Rights Reserved. 金石工作室 版权所有