流星雨
將下列程式碼複製至<head>程式碼</head>區內。
<script language="JavaScript1.2"> <!-- var ns=(document.layers); var ie=(document.all); var w3=(document.getElementById && self.innerWidth && (window.pageXOffset>-1)); //my way of making sure the browser will have what I need var allDivs = new Array(14); var documentWidth,documentHeight; function initAll(){ if(!ns && !ie && !w3) return; for(dNum=0; dNum<10; ++dNum){ if(ie) allDivs[dNum]=eval('document.all.sDiv'+dNum+'.style'); else if(ns) allDivs[dNum]=eval('document.layers["sDiv'+dNum+'"]'); else if(w3) allDivs[dNum]=eval('document.getElementById("sDiv'+dNum+'").style'); moveTo(dNum,0,0); } } function moveTo(i,tempx,tempy){ if (ie){ documentWidth =document.body.offsetWidth+document.body.scrollLeft-20; randomy=Math.floor(Math.random()*document.body.offsetHeight)+document.body.scrollTop-20; } else if (ns){ documentWidth=window.innerWidth+window.pageXOffset-20; randomy=Math.floor(Math.random()*window.innerHeight)+window.pageYOffset-20; } else if (w3){ documentWidth=self.innerWidth+window.pageXOffset-20; randomy=Math.floor(Math.random()*self.innerHeight)+window.pageYOffset-20; } if(tempx>-50){ tempx-=45; allDivs[i].left=tempx; allDivs[i].top =tempy; setTimeout("moveTo("+i+","+tempx+","+tempy+")",40) } else setTimeout("moveTo("+i+",documentWidth-60,randomy)",2000/i+40); } window.onload=initAll //End--> </script> <div id="sDiv0"> * </div> <div id="sDiv1"> * </div> <div id="sDiv2"> * </div> <div id="sDiv3"> * </div> <div id="sDiv4"> * </div> <div id="sDiv5"> * </div> <div id="sDiv6"> * </div> <div id="sDiv7"> * </div> <div id="sDiv8"> * </div> <div id="sDiv9"> * </div> <div id="sDiv10"> * </div> <div id="sDiv11"> * </div> <div id="sDiv12"> * </div> <div id="sDiv13"> * </div> |
將下列程式碼複製至<body>程式碼</body>之間。
<style type="text/css"> <!-- .mt { font-size:16px; color:66FF99; } A:ACTIVE, A:LINK, A:VISITED { font-size:11px; color : ffffcc; font-family : Verdana, Arial, Helvetica, sans-serif; font-weight : bold; text-decoration : none; } A:HOVER { color : 009F8C; text-decoration : underline; } BODY { background-color : black; scrollbar-track-color : black; } #sDiv0 {position:absolute; height:1; width:1; font-family:arial black; font-size:16px; color:Aqua;} #sDiv1 {position:absolute; height:1; width:1; font-family:arial black; font-size:16px; color:red;} #sDiv2 {position:absolute; height:1; width:1; font-family:arial black; font-size:16px; color:blue;} #sDiv3 {position:absolute; height:1; width:1; font-family:arial black; font-size:16px; color:orange;} #sDiv4 {position:absolute; height:1; width:1; font-family:arial black; font-size:16px; color:yellow;} #sDiv5 {position:absolute; height:1; width:1; font-family:arial black; font-size:16px; color:Aqua;} #sDiv6 {position:absolute; height:1; width:1; font-family:arial black; font-size:16px; color:red;} #sDiv7 {position:absolute; height:1; width:1; font-family:arial black; font-size:16px; color:blue;} #sDiv8 {position:absolute; height:1; width:1; font-family:arial black; font-size:16px; color:orange;} #sDiv9 {position:absolute; height:1; width:1; font-family:arial black; font-size:16px; color:yellow;} #sDiv10 {position:absolute; height:1; width:1; font-family:arial black; font-size:16px; color:66ffff;} #sDiv11 {position:absolute; height:1; width:1; font-family:arial black; font-size:16px; color:ff6600;} #sDiv12 {position:absolute; height:1; width:1; font-family:arial black; font-size:16px; color:ff3300;} #sDiv13 {position:absolute; height:1; width:1; font-family:arial black; font-size:16px; color:00ff66;} //--> </style> |