用javascript实现的几种效果 |
|
说明:没有提供NS的版本!
<html><head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <title>Letter For OSO.COM.CN</title> <style> body {cursor:crosshair;color:mediumblue;background-color:steelblue;font-size:26;font-family:Arial} a {text-decoration:none} a:hover {color:blue;text-decoration:underline} span.glowit {font-size:36;color:firebrick;height:1} </style></head> <body scroll=auto> <P><SPAN class="glowit"><strong><a href="http://www.oso.com.cn">www.oso.com.cn:</a></strong></SPAN></P> <P> Hi,,oso.com.cn . Thanks For The Free Space & Free Database . </P> <P> This Is My First Example For All Net Friends Who Study JavaScript . Wish You All Like The Snows & Glow Fonts . </P> <p align="right"><span class="glowit" style="COLOR: darkgreen" id=SPAN1><strong>Your Member : <a href="mailto:[email protected]"><span style="color: darkgreen">Lostinet</span></a></strong></span></p> </body> <script> function window.onload() { if(screen.fontSmoothingEnabled)return; //Tip For FontSmooth document.body.insertAdjacentHTML("BeforeEnd","<p>Tip:If You Enable The FontSmooth In The Display Control Panel<br>The Font Will Become Nicer ."); } /****************************************************************\++++++++ Session For Glow Words \****************************************************************/ var colGlowIt=new Array(); var intGlowIt=0; var intGlowItType=4; var intGlowItBase=2; var intGlowItTimeout=100; window.attachEvent("onload",StartGlowIt); function StartGlowIt() { var item=null; var col=document.all.tags("span"); for(i=0;i<col.length;i++) { item=col.item(i); if(item.className!="glowit")continue; colGlowIt[colGlowIt.length]=col.item(i); } if(!colGlowIt.length)return; ContinueGlowIt(); } function ContinueGlowIt() { intGlowIt+=1; if(((intGlowIt-intGlowIt%intGlowItType)/intGlowItType)%2) { intGlowItStrength=intGlowItType-intGlowIt%intGlowItType; } else { intGlowItStrength=intGlowIt%intGlowItType; } intGlowItStrength+=intGlowItBase; for(i=0;i<colGlowIt.length;i++) { o=colGlowIt[i]; filterGlow="glow(color="+o.currentStyle.color+",strength="+intGlowItStrength+")"; filterMask="mask(color="+o.currentStyle.color+")"; filterBlur="blur(Strength=2)"; o.style.filter=filterGlow+filterMask+filterBlur+filterGlow; } setTimeout("ContinueGlowIt()",intGlowItTimeout); } /****************************************************************\-------- Session For Glow Words \****************************************************************/ /****************************************************************\++++++++ Session For Snows \****************************************************************/ var intSnowCount=32; var strSnow="*"; var intSnowSpeedLow=4; var intSnowSpeedHigh=7; var arrSnow=null; var intSnowTimeout=50; var idSnowInterval=0; window.attachEvent("onload",startSnow); function startSnow() { CreateSnows(); idSnowInterval=setInterval("MoveSnows()",intSnowTimeout); } function CreateSnows() { arrSnow=new Array(); var oDivTmp=null; for(i=0;i<intSnowCount;i++) { oDivTmp=document.createElement("DIV"); oDivTmp.style.position="absolute"; document.body.insertAdjacentElement("BeforeEnd",oDivTmp); while(!oDivTmp.style.pixelTop)oDivTmp.style.pixelTop=screen.availHeight*Math.random(); while(!oDivTmp.style.pixelLeft)oDivTmp.style.pixelLeft=screen.availWidth*Math.random(); oDivTmp.speed=intSnowSpeedLow+(i%(intSnowSpeedHigh-intSnowSpeedLow)); oDivTmp.innerHTML="<font color='white' size="+oDivTmp.speed+">"+strSnow+"</font>"; while(!oDivTmp.vDirect)oDivTmp.vDirect=2*Math.random()-1; oDivTmp.vDirect+=((oDivTmp.vDirect>0)?1/2:-1/2); arrSnow[arrSnow.length]=oDivTmp } } function MoveSnows() { for(i=0;i<arrSnow.length;i++) MoveSnow(arrSnow[i]); } function MoveSnow(oDiv) { m=32 w=Math.max(document.body.scrollWidth,document.body.offsetWidth)-m; h=Math.max(document.body.scrollHeight,document.body.offsetHeight)-m; l=m; t=m; pixelLeft=oDiv.style.pixelLeft+oDiv.vDirect*Math.random()*oDiv.speed/2; if(pixelLeft>w-oDiv.offsetWidth)pixelLeft=l; if(pixelLeft<l)pixelLeft+=w-oDiv.style.pixelWidth-2*l; oDiv.style.pixelLeft=pixelLeft; pixelTop=oDiv.style.pixelTop+Math.random()*oDiv.speed; if(pixelTop>h-oDiv.offsetHeight)pixelTop=t; oDiv.style.pixelTop=pixelTop; } /****************************************************************\-------- Session For Snows \****************************************************************/ </script></html> |