[Beschreibung]
Mit diesem Script verleihen Sie einem zweiten Mauszeiger ein Eigenleben ;-)
[Kompatibilität]
[Code]
<script language="JavaScript"> <!-- /*Naughty Windows Script by kurt.grigg@virgin.net http://website.lineone.net/~kurt.grigg/javascript modified by N8i (www.nightfire.ch) Script works now with DOM compliant browsers */ //Pre-load your image below! Image0=new Image(); Image0.src="arrow4.gif"; Image1=new Image(); Image1.src="handx.gif"; Image2=new Image(); Image2.src="arrow.gif"; Image3=new Image(); Image3.src="time.gif"; Image4=new Image(); Image4.src="arrow2"; Image5=new Image(); Image5.src="hand.gif";
//Pre-load your image below!
cursors=new Array(6) cursors[0]="arrow4.gif" cursors[1]="handx.gif" cursors[2]="arrow.gif" cursors[3]="time.gif" cursors[4]="arrow2.gif" cursors[5]="hand.gif"
Pic="arrow.gif"; //Type any of above here! BY=-22; //Your image height! BX=-17; //Your image width! SY=3; //Up-down speed! SX=5; //Left-right speed!
/************************ ab hier nichts mehr ändern ************************/ //Browser Sniffer var ns4up = (document.layers) ? 1 : 0; var ie4up = (document.all) ? 1 : 0; var mozup = (!document.all && document.getElementById) ? 1 : 0; if (ns4up){ document.write("<LAYER NAME='netscape' LEFT=0 TOP=0><img src="+Pic+"></LAYER>"); } if (ie4up){ document.write("<div style='position:absolute;top:0px;left:0px'><div style='position:relative'>"); document.write("<img id='explorer' src='"+Pic+"' style='position:absolute;top:0px;left:0px'>"); document.write("</div></div>") } if (mozup) { document.write("<div id='moz' style='position:absolute;top:0px;left:0px'><img src='"+Pic+"'></div>"); } R=0,PB=0,RD=0,Y=0,X=0,D=0,VB=0,HB=0; Y=10;X=10;D=Math.floor(Math.random()*60+10); function Curve(){ plusMinus=new Array(1,-1,2,-2,3,-3,0,1,-1) R=Math.floor(Math.random()*plusMinus.length); RD=plusMinus[R]; setTimeout('Curve()',1800); } function MoveRandom(){ setTimeout('MoveRandom()',10); var H=(ns4up||mozup)?window.innerHeight:document.body.clientHeight; var W=(ns4up||mozup)?window.innerWidth:document.body.clientWidth; var YS=(ns4up||mozup)?window.pageYOffset:document.body.scrollTop; var XS=(ns4up||mozup)?window.pageXOffset:document.body.scrollLeft; PB=D+=RD; y = SY*Math.sin(PB*Math.PI/180); x = SX*Math.cos(PB*Math.PI/180); if (D < 0) D+=360; Y+=y; X+=x; VB=180-D; HB=0-D; //Corner rebounds! not necessary but looks nice. if ((Y < 1) && (X < 1)) {Y=1;X=1;D=45;} if ((Y < 1) && (X > W+BX)) {Y=1;X=W+BX;D=135;} if ((Y > H+BY) && (X < 1)) {Y=H+BY;X=1;D=315;} if ((Y > H+BY) && (X > W+BX)) {Y=H+BY;X=W+BX;D=225;} //Edge rebounds! if (Y < 1) {Y=1;D=HB;} if (Y > H+BY) {Y=H+BY;D=HB;} if (X < 1) {X=1;D=VB;} if (X > W+BX) {X=W+BX;D=VB;} var layer=(ns4up)?document.netscape:(ie4up)?explorer.style:document.getElementById("moz").style; layer.top=Y+YS; layer.left=X+XS; } count=0; move=1; function picSwap(){ if (count >= cursors.length)count=0; if (ns4up) document.layers['netscape'].document.images['N'].src=cursors[count]; if (ie4up) explorer.src=cursors[count]; if (mozup) document.getElementById("moz").firstChild.src=cursors[count]; count+=move; setTimeout('picSwap()',2500); } function sTaRt(){Curve();MoveRandom();picSwap()} if (ns4up||ie4up||mozup){window.onload=sTaRt} //--> </script>
Kurt Grigg modified by N8i (www.nightfire.ch)