wlaudlim
Members-
Content Count
2 -
Joined
-
Last visited
Everything posted by wlaudlim
-
Put this source inbetween <head> and </head>!!!! script language="JavaScript1.2"><!--var rate = 20; var obj; var act = 0; var elmH = 0; var elmS = 128; var elmV = 255; var clrOrg; var TimerID; if (navigator.appName.indexOf("Microsoft",0) != -1 && parseInt(navigator.appVersion) >= 4) { Browser = true; } else { Browser = false; } if (Browser) { document.onmouseover = doRainbowAnchor; document.onmouseout = stopRainbowAnchor; } function doRainbow(){ if (Browser && act != 1) { act = 1; obj = event.srcElement; clrOrg = obj.style.color; TimerID = setInterval("ChangeColor()",100); } } function stopRainbow(){ if (Browser && act != 0) { obj.style.color = clrOrg; clearInterval(TimerID); act = 0; } } function doRainbowAnchor(){ if (Browser && act != 1) { obj = event.srcElement; while (obj.tagName != 'A' && obj.tagName != 'BODY') { obj = obj.parentElement; if (obj.tagName == 'A' || obj.tagName == 'BODY') break; } if (obj.tagName == 'A' && obj.href != '') { act = 1; clrOrg = obj.style.color; TimerID = setInterval("ChangeColor()",100); } } } function stopRainbowAnchor(){ if (Browser && act != 0) { if (obj.tagName == 'A') { obj.style.color = clrOrg; clearInterval(TimerID); act = 0; } } } function ChangeColor(){ obj.style.color = makeColor(); } function makeColor(){ if (elmS == 0) { elmR = elmV; elmG = elmV; elmB = elmV; } else { t1 = elmV; t2 = (255 - elmS) * elmV / 255; t3 = elmH % 60; t3 = (t1 - t2) * t3 / 60; if (elmH < 60) { elmR = t1; elmB = t2; elmG = t2 + t3; } else if (elmH < 120) { elmG = t1; elmB = t2; elmR = t1 - t3; } else if (elmH < 180) { elmG = t1; elmR = t2; elmB = t2 + t3; } else if (elmH < 240) { elmB = t1; elmR = t2; elmG = t1 - t3; } else if (elmH < 300) { elmB = t1; elmG = t2; elmR = t2 + t3; } else if (elmH < 360) { elmR = t1; elmG = t2; elmB = t1 - t3; } else { elmR = 0; elmG = 0; elmB = 0; } } elmR = Math.floor(elmR); elmG = Math.floor(elmG); elmB = Math.floor(elmB); clrRGB = '#' + elmR.toString(16) + elmG.toString(16) + elmB.toString(16); elmH = elmH + rate; if (elmH >= 360) elmH = 0; return clrRGB; } // --></script> At the line "TimerID = setInterval("ChangeColor()",100); " of above soruce 100 is speed of changing color. Good Luck!!! Notice from wwheeler: Please next time you are going to post code, please do so in code tags.
-
this is java script source to make firework effect on webpage.. Put this source at body. <script language="JavaScript"> <!-- IE4+, NS4+, NS6 Fireworks script by kurt.grigg@virgin.net CL=new Array('#ff0000','#00ff00','#ffffff','#ff00ff','#ffa500','#ffff00','#00ff00','#ffffff','#ff00ff') CL2=new Array('#ffa500','#00ff00','#ffaaff','#fff000','#ffffff') Xpos=130; Ypos=130; I='#00ff00'; C=0; S=5; H=null; W=null; Y=null; NS4=(document.layers); NS6=(document.getElementById&&!document.all); IE4=(document.all); A=14; E=120; L=null; if (NS4){ for (i=0; i < A; i++) document.write('<LAYER NAME="nsstars'+i+'" TOP=0 LEFT=0 BGCOLOR='+I+' CLIP="0,0,2,2"></LAYER>'); } if (NS6){ window.document.body.style.overflow='hidden'; for (i=0; i < A; i++) document.write('<div id="ns6stars'+i+'" style="position:absolute;top:0px;left:0px;height:2px;width:2px;font-size:2px;background:'+I+'"></div>'); } if (IE4){ document.write('<div id="ie" style="position:absolute;top:0px;left:0px"><div style="position:relative">'); for (i=0; i < A; i++) document.write('<div id="iestars" style="position:absolute;top:0;left:0;width:2px;height:2px;background:'+I+';font-size:2px"></div>'); document.write('</div></div>'); } function Fireworks(){ H=(NS4||NS6)?window.innerHeight:window.document.body.clientHeight; W=(NS4||NS6)?window.innerWidth:window.document.body.clientWidth; Y=(NS4||NS6)?window.pageYOffset:window.document.body.scrollTop; for (i=0; i < A; i++){ if (IE4)L=iestars.style; if (NS4)L=document.layers["nsstars"+i]; if (NS6)L=document.getElementById("ns6stars"+i).style; var F=Math.floor(Math.random()*CL.length); var RS=Math.round(Math.random()*2); L.top = Ypos + E*Math.sin((C+i*5)/3)*Math.sin(C/100) L.left= Xpos + E*Math.cos((C+i*5)/3)*Math.sin(C/100) if (C < 110){ if (NS4){L.bgColor=I;L.clip.width=1;L.clip.height=1} if (IE4||document.getElementById) {L.background=I;L.width=1;L.height=1;L.fontSize=1} } else{ if (NS4){L.bgColor=CL[F];L.clip.width=RS;L.clip.height=RS} if (IE4||document.getElementById){L.background=CL[F];L.width=RS;L.height=RS;L.fontSize=RS} } } if (C > 220){ C=0; var NC=Math.floor(Math.random()*CL2.length); I=CL2[NC]; E=Math.round(100+Math.random()*50); Ypos = E+Math.round(Math.random()*(H-(E*2.2)))+Y; Xpos = E+Math.round(Math.random()*(W-(E*2.2))); } C+=S; setTimeout("Fireworks()",10); } Fireworks(); // --> </script> of course you can change colors