Изменение вида курсора на один из стандартных
<spoiler>
Посмотреть
<html> <head> <title>Изменение вида курсора на один из стандартных</title> </head> <body> <table border="1"> <tr> <td align="center" style="cursor:crosshair;" >cursor:crosshair</td> <td align="center" style="cursor:pointer">cursor:pointer</td> <td align="center" style="cursor:move;">cursor:move</td> <td align="center" style="cursor:e-resize;">cursor:e-resize</td> </tr> <tr> <td align="center" style="cursor:ne-resize;">cursor:ne-resize</td> <td align="center" style="cursor:nw-resize;">cursor:nw-resize</td> <td align="center" style="cursor:n-resize;">cursor:n-resize</td> <td align="center" style="cursor:sw-resize;">cursor:sw-resize</td> </tr> <tr> <td align="center" style="cursor:se-resize;">cursor:se-resize</td> <td align="center" style="cursor:s-resize;">cursor:s-resize</td> <td align="center" style="cursor:w-resize;">cursor:w-resize</td> <td align="center" style="cursor:text;">cursor:text</td> </tr> <tr> <td align="center" style="cursor:wait;">cursor:wait</td> <td align="center" style="cursor:help;">cursor:help</td> <td align="center" style="cursor:auto;">cursor:auto</td> <td align="center" style="cursor:auto;"> </td> </tr> </table> </body> </html>
<endspoiler>
Вокруг курсора летают разноцветные точки
<spoiler>
Посмотреть
<html> <head> <title>Вокруг курсора летают цветные точки</title> </head> <body> </head> <body> <script language="JavaScript"> function YY_Layerfx(yyleft,yytop,yyfnx,yyfny,yydiv,yybilder,yyloop,yyto,yycnt,yystep) { //v1.2 if ((document.layers)||(document.all)){ with (Math) {yynextx= eval(yyfnx)} with (Math) {yynexty= eval(yyfny)} yycnt=(yyloop && yycnt>=yystep*yybilder)?0:yycnt+yystep; if (document.layers){ eval(yydiv+".top="+(yynexty+yytop)) eval(yydiv+".left="+(yynextx+yyleft)) } if (document.all){ eval("yydiv=yydiv.replace(/.layers/gi, '.all')"); eval(yydiv+".style.pixelTop="+(yynexty+yytop)); eval(yydiv+".style.pixelLeft="+(yynextx+yyleft)); } argStr='YY_Layerfx('+yyleft+','+yytop+',"'+yyfnx+'","'+yyfny+'","'+yydiv+'",'+yybilder+','+yyloop+','+yyto+','+yycnt+','+yystep+')'; if (yycnt<=yystep*yybilder){eval(yydiv+".yyto=setTimeout(argStr,yyto)");} }} function YY_Mousetrace(evnt) { if (yyns4) {if (evnt.pageX) {yy_ml=evnt.pageX; yy_mt=evnt.pageY;} } else{ yy_ml=(event.clientX + document.body.scrollLeft); yy_mt=(event.clientY + document.body.scrollTop);} if (yy_tracescript)eval(yy_tracescript)} </script> <div id="yyd0" style="position:absolute; left:10px; top:50px; width:3px; height:3px; z-index:1; background-color: #19636c; layer-background-color: #19636c; border: 1px none #000000; clip: rect(0 3 3 0)"></div> <div id="yyd1" style="position:absolute; left:20px; top:50px; width:3px; height:3px; z-index:1; background-color: #708574; layer-background-color: #708574; border: 1px none #000000; clip: rect(0 3 3 0)"></div> <div id="yyd2" style="position:absolute; left:30px; top:50px; width:3px; height:3px; z-index:1; background-color: #379bbf; layer-background-color: #379bbf; border: 1px none #000000; clip: rect(0 3 3 0)"></div> <div id="yyd3" style="position:absolute; left:40px; top:50px; width:3px; height:3px; z-index:1; background-color: #25184c; layer-background-color: #25184c; border: 1px none #000000; clip: rect(0 3 3 0)"></div> <div id="yyd4" style="position:absolute; left:50px; top:50px; width:3px; height:3px; z-index:1; background-color: #31bd3c; layer-background-color: #31bd3c; border: 1px none #000000; clip: rect(0 3 3 0)"></div> <div id="yyd5" style="position:absolute; left:60px; top:50px; width:3px; height:3px; z-index:1; background-color: #c11efd; layer-background-color: #c11efd; border: 1px none #000000; clip: rect(0 3 3 0)"></div> <script> var yyns4=window.Event?true:false; var yy_mt = 0; var yy_ml = 0; document.onmousemove = YY_Mousetrace; yy_tracescript = ''; if (yyns4){ document.captureEvents(Event.mousemove); YY_Mousetrace('',',document.YY_Mousetrace1')} YY_Layerfx(0,0,'yy_ml+cos((15*sin(yycnt/39.83007847812662))+0)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','yy_mt+sin((15*sin(yycnt/34.224861639800686))+0)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','document.layers[\'yyd0\']',2000,true,80,0,1); YY_Layerfx(0,0,'yy_ml+cos((15*sin(yycnt/27.66510707209673))+30)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','yy_mt+sin((15*sin(yycnt/9.240632767417667))+30)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','document.layers[\'yyd1\']',2000,true,80,0,1); YY_Layerfx(0,0,'yy_ml+cos((15*sin(yycnt/16.45318944579641))+60)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','yy_mt+sin((15*sin(yycnt/16.0564452288292))+60)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','document.layers[\'yyd2\']',2000,true,80,0,1); YY_Layerfx(0,0,'yy_ml+cos((15*sin(yycnt/6.95348954836835))+90)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','yy_mt+sin((15*sin(yycnt/44.13697049887155))+90)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','document.layers[\'yyd3\']',2000,true,80,0,1); YY_Layerfx(0,0,'yy_ml+cos((15*sin(yycnt/33.90077294583733))+120)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','yy_mt+sin((15*sin(yycnt/2.2378828869411587))+120)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','document.layers[\'yyd4\']',2000,true,80,0,1); YY_Layerfx(0,0,'yy_ml+cos((15*sin(yycnt/37.858312521039835))+150)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','yy_mt+sin((15*sin(yycnt/18.083839795990098))+150)*150*(sin(10+yycnt/20)+0.2)*cos(yycnt/20)','document.layers[\'yyd5\']',2000,true,80,0,1); </script> </body> </html>
<endspoiler>
Салют при щелчке мышью
<spoiler>
Посмотреть
<html> <head> <title>Салют при щелчке мышью</title> <script language="JavaScript1.2"> <!-- var ver = navigator.appVersion; var dom = document.getElementById ? 1 : 0; var ie5 = (ver.indexOf("MSIE 5") > -1 && dom) ? 1 : 0; var n = (document.layers); var ie = (document.all); var sparksAflyin = 0; var totalSparks = 0; var sparksOn = 1; function initMouseEvents() { document.onmousedown = mouseDown; if (n) document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE); } function mouseDown(e) { if (sparksOn) { var mousex = (n) ? e.pageX : event.x+document.body.scrollLeft; var mousey = (n) ? e.pageY : event.y+document.body.scrollTop; if (!sparksAflyin) { for (var k = 0; k <= 9; k++) eval('SHOW("sDiv'+k+'")'); sparksAflyin = 1; totalSparks = 0; for(i = 0;i <= 9; i++) eval('moveTo('+i+',0,'+mousex+','+mousey+')'); } } } function moveTo(i,j, mousex, mousey){ if (j < eval('anim_'+i+'_x.length') ){ var tempx = eval('anim_'+i+'_x[j]+mousex'); var tempy = eval('anim_'+i+'_y[j]+mousey'); if (ie) { if(tempy+30 > (document.body.offsetHeight+document.body.scrollTop)) tempy = document.body.offsetHeight+document.body.scrollTop-30; if(tempx+30 > (document.body.offsetWidth+document.body.scrollLeft)) tempx = document.body.offsetWidth+document.body.scrollLeft-30; eval('document.all.sDiv'+i+'.style.left = tempx;'); eval('document.all.sDiv'+i+'.style.top = tempy;'); } if (n) { eval('document.layers.sDiv'+i+'.left = tempx;'); eval('document.layers.sDiv'+i+'.top = tempy;'); } j++; // timeout: 50 = fireworks speed, larger number = slower speed setTimeout("moveTo("+i+","+j+","+mousex+","+mousey+")",50) } else { eval('HIDE("sDiv'+i+'")'); totalSparks++; } if (totalSparks == 10) { sparksAflyin = 0; totalSparks = 0; } } function SHOW(divName){ if (document.all) eval('document.all.'+divName+'.style.visibility = "visible";'); else if (document.layers) eval('document.layers["'+divName+'"].visibility = "visible";'); } function HIDE(divName){ if (document.all) eval('document.all.'+divName+'.style.visibility = "hidden";'); else if (document.layers) eval('document.layers["'+divName+'"].visibility = "hide";'); } anim_0_x=new Array(20,20,10,0,0,0,0,0,0,0,0,0); anim_0_y=new Array(-20,-40,-60,-80,-60,-40,-20,0,20,40,60,80); anim_1_x=new Array(20,20,17,36,60,78,90,92,93,98,108,120,133,152,181); anim_1_y=new Array(-20,-20,-33,-38,-38,-27,-2,25,51,84,113,141,162,212,253); anim_2_x=new Array(20,20,2,3,4,5,6,7,8,9,10,12,13,15,18); anim_2_y=new Array(-20,-20,-33,-38,-38,-27,-2,25,51,84,113,141,162,212,253); anim_3_x=new Array(-20,-20,-2,-1,7,10,18,35,60,102,94,94,93,97,108,111,117,127); anim_3_y=new Array(-20,-25,-64,-89,-104,-150,-173,-197,-213,-199,-151,-101,-66,-17,27,87,140,189); anim_4_x=new Array(-20,-20,-10,-39,-30,-69,-64,-138,-154,-200,-181,-209,-191,-207,-203,-213,-202,-221,-211); anim_4_y=new Array(-20,-20,-28,-51,-79,-100,-135,-154,-193,-183,-149,-134,-89,-60,8,51,107,157,201); anim_5_x=new Array(-20,-29,-51,-72,-105,-133,-164,-189,-209,-229,-247,-270,-279,-282,-283,-283,-285,-286,-288); anim_5_y=new Array(-20,-55,-86,-116,-154,-183,-205,-217,-217,-198,-169,-120,-44,-8,40,87,144,190,248); anim_6_x=new Array(-20,-20,-7,14,44,79,143,186,217,226,234,244,250,259,265,274); anim_6_y=new Array(-20,-21,-72,-113,-139,-166,-188,-181,-126,-68,-3,54,134,187,215,257); anim_7_x=new Array(20,20,-3,-9,-13,-27,-33,-44,-54,-66,-77,-95,-107,-136,-150,-160,-164,-168,-171,-172,-172,-176,-175); anim_7_y=new Array(-20,-26,-43,-63,-89,-116,-145,-169,-201,-222,-240,-253,-254,-245,-220,-195,-160,-124,-81,-53,-26,19,68); anim_8_x=new Array(-20,20,-35,39,0,45,-1,24,-15,14,-20,35,-18,38,-11,16,49,64,81,93,100,103,109); anim_8_y=new Array(-20,-20,-32,-42,-62,-76,-89,-107,-132,-147,-173,-180,-192,-209,-236,-193,-119,-73,-24,51,95,130,188); anim_9_x=new Array(-20,-51,-89,-110,-165,-191,-228,-240,-259,-271,-277,-281,-287); anim_9_y=new Array(-20,-20,-35,-37,-34,-16,10,47,105,150,189,227,273); // End --> </script> </head> <body bgcolor="#000000" text="#9B4E00" link="#8000FF" alink="#9B4E00" vlink="#9B4E00" OnLoad="initMouseEvents()"> <div id="sparks"> <div id="sDiv0" style="position:absolute; visibility: hidden;"><font face="arial black" color="red">.</font></div> <div id="sDiv1" style="position:absolute; visibility: hidden;"><font face="arial black" color="yellow">.</font></div> <div id="sDiv2" style="position:absolute; visibility: hidden;"><font face="arial black" color="blue">.</font></div> <div id="sDiv3" style="position:absolute; visibility: hidden;"><font face="arial black" color="red">.</font></div> <div id="sDiv4" style="position:absolute; visibility: hidden;"><font face="arial black" color="orange">.</font></div> <div id="sDiv5" style="position:absolute; visibility: hidden;"><font face="arial black" color="white">.</font></div> <div id="sDiv6" style="position:absolute; visibility: hidden;"><font face="arial black" color="green">.</font></div> <div id="sDiv7" style="position:absolute; visibility: hidden;"><font face="arial black" color="skyblue">.</font></div> <div id="sDiv8" style="position:absolute; visibility: hidden;"><font face="arial black" color="yellow">.</font></div> <div id="sDiv9" style="position:absolute; visibility: hidden;"><font face="arial black" color="white">.</font></div> </div> </body> </html>
<endspoiler>
Текст возле курсора
<spoiler>
Посмотреть
<html> <head> <title>Текст возле курсора</title> <style type="text/css"> .spanstyle { position:absolute; visibility:visible; top:-50px; font-size:10pt; font-family:Verdana; font-weight:bold; color:white;} </style> <script> var x,y var step=20 var flag=0 var message="Текст возле курсора " // Текст возле курсора (обязательно после последней буквы пробел) message=message.split("") var xpos=new Array() for (i=0;i<=message.length-1;i++) { xpos[i]=-50 } var ypos=new Array() for (i=0;i<=message.length-1;i++) { ypos[i]=-50 } function handlerMM(e){ x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY flag=1 } function makesnake() { if (flag==1 && document.all) { for (i=message.length-1; i>=1; i--) { xpos[i]=xpos[i-1]+step ypos[i]=ypos[i-1] } xpos[0]=x+step ypos[0]=y for (i=0; i<message.length-1; i++) { var thisspan = eval("span"+(i)+".style") thisspan.posLeft=xpos[i] thisspan.posTop=ypos[i] } } else if (flag==1 && document.layers) { for (i=message.length-1; i>=1; i--) { xpos[i]=xpos[i-1]+step ypos[i]=ypos[i-1] } xpos[0]=x+step ypos[0]=y for (i=0; i<message.length-1; i++) { var thisspan = eval("document.span"+i) thisspan.left=xpos[i] thisspan.top=ypos[i] } } var timer=setTimeout("makesnake()",30) } </script> </head> <body onLoad="makesnake()" style="width:100%;overflow-x:hidden;overflow-y:scroll"> <script> <!-- Beginning of JavaScript - for (i=0;i<=message.length-1;i++) { document.write("<span id='span"+i+"' class='spanstyle'><font color='#99ff00'>") document.write(message[i]) document.write("</font></span>") } if (document.layers){ document.captureEvents(Event.MOUSEMOVE); } document.onmousemove = handlerMM; // --> </script> </body> </html>
<endspoiler>
К курсору летят змейки
<spoiler>
Посмотреть
<html> <head> <title>К курсору летят змейки.</title> <script language=JavaScript> <!-- /* попробуйте поставить высокую скорость (200), получается интересный эффект */ var speed=20,divTop=0,divLeft=0,angle=0,ypos=0,xpos=0,amount=15; if (document.layers){ for (i = 0; i < amount; i++) {document.write('<layer name=nsa'+i+' top=0 left=0 width='+i/3+' height='+i/3+' bgcolor=#ffffff></layer>');} window.captureEvents(Event.MOUSEMOVE); function nsMouse(evnt){ xpos=evnt.pageX;ypos=evnt.pageY; } window.onMouseMove = nsMouse; } else if (document.all){ document.write('<div style="position:absolute;top:0px;left:0px">'); document.write('<div style="position:relative">'); for (i = 0; i < amount; i++) {document.write('<div id=k style="position:absolute; top:0px;left:0px;width:'+i/3+';height:'+i/3+'; background:#ffffff;font-size:'+i/3+'"></div>')} document.write('</div></div>'); function iMouse(){xpos=event.x;ypos=document.body.scrollTop+event.y} document.onmousemove = iMouse; } function getAngle(){ Y = ypos - divTop;X = xpos - divLeft;angle = Math.round(Math.atan2(Y,X) * 180/Math.PI); if (angle < 0)angle += 360; } function bomb(){ if (document.layers){ Yscroll=window.pageYOffset; ybase=Math.round(Math.random()*window.innerHeight);xbase=Math.round(Math.random()*window.innerWidth); yybase=window.innerHeight-10;xxbase=window.innerWidth-10; } else if (document.all){ Yscroll=document.body.scrollTop; ybase=Math.round(Math.random()*window.document.body.offsetHeight);xbase=Math.round(Math.random()*window.document.body.offsetWidth); xxbase=window.document.body.offsetWidth-10;yybase=window.document.body.offsetHeight-10; } if ((xbase > 10 && xbase < xxbase) && (ybase > 10 && ybase < yybase)) bomb(); else { if ((divLeft > xpos-speed/1.5) && (divLeft < xpos+speed/1.5) && (divTop >= ypos-speed/1.5) && (divTop <= ypos+speed/1.5)) {divTop=ybase+Yscroll;divLeft=xbase} y = Math.round(speed*Math.sin(angle*Math.PI/180));x = Math.round(speed*Math.cos(angle*Math.PI/180)); divTop+=y;divLeft+=x; getAngle(); T=setTimeout('bomb()',20); } } function Split(){ Clrs=new Array('ffffff','00ff00','ffff00') var ntscp=document.layers,msie=document.all; if (document.layers){ for (i = 0; i < amount; i++) { if (i < amount-1) {ntscp['nsa'+i].top=ntscp['nsa'+(i+1)].top;ntscp['nsa'+i].left=ntscp['nsa'+(i+1)].left} else {ntscp['nsa'+i].top=divTop;ntscp['nsa'+i].left=divLeft} } } else if (document.all){ for (i = 0; i < amount; i++) { if (i < amount-1) {msie.k[i].style.top=msie.k[i+1].style.top;msie.k[i].style.left=msie.k[i+1].style.left} else {msie.k[i].style.top=divTop;msie.k[i].style.left=divLeft} } } for (i=0; i < amount-1; i++) { for (n=0; n < Clrs.length; n++) {var x=Math.round(Math.random()*n)} if (document.layers){ntscp['nsa'+i].bgColor=Clrs[x]} else if (document.all){msie.k[i].style.background=Clrs[x]} } setTimeout("Split()",20); } function StArT(){bomb();Split()} window.onload=StArT; //--> </script> </head> <body> </body> </html>
<endspoiler>
За курсором летают слова
<spoiler>
Посмотреть
<head> <title>Слова скользят за курсором на разных слоях и растоянии.</title> </head> <body> <div id=dot0>Текст страницы который будет неподвижен</div> <div style='position:absolute' id=dot1><h1>Очень</h1> <!-- Первый скользящий слой --></div> <div style='position:absolute' id=dot2><h2>прикольный</h2> <!-- Второй скользящий слой --></div> <div style='position:absolute' id=dot3><strong>скрипт</strong> <!-- Третий скользящий слой --></div> <div style='position:absolute' id=dot4><em>:D)</em> <!-- Четвертый скользящий слой --></div> <script language="JavaScript"> <!-- Begin var nDots = 5; //Количество слоев включая неподвижный нулевой var Xpos = 0; var Ypos = 0; var DELTAT = .01; var SEGLEN = 10; var SPRINGK = 10; var MASS = 1; var GRAVITY = 50; var RESISTANCE = 10; var STOPVEL = 0.1; var STOPACC = 0.1; var DOTSIZE = 11; var BOUNCE = 0.75; var isNetscape = navigator.appName=="Netscape"; var followmouse = true; var dots = new Array(); init(); function init() { var i = 0; for (i = 0; i < nDots; i++) { dots[i] = new dot(i);} if (!isNetscape) {} for (i = 0; i < nDots; i++) { dots[i].obj.left = dots[i].X; dots[i].obj.top = dots[i].Y; } if (isNetscape) { startanimate(); } else { setTimeout("startanimate()", 1000); // время до момента начала скольжения обектов за курсром }} function dot(i) { this.X = Xpos; this.Y = Ypos; this.dx = 0; this.dy = 0; if (isNetscape) { this.obj = eval("document.dot" + i); } else { this.obj = eval("dot" + i + ".style"); }} function startanimate() { setInterval("animate()", 20); } function setInitPositions(dots) { var startloc = document.all.tags("LI"); var i = 0; for (i = 0; i < startloc.length && i < (nDots - 1); i++) { dots[i+1].X = startloc[i].offsetLeftstartloc[i].offsetParent.offsetLeft - DOTSIZE; dots[i+1].Y = startloc[i].offsetTop +startloc[i].offsetParent.offsetTop + 2*DOTSIZE;} dots[0].X = dots[1].X; dots[0].Y = dots[1].Y - SEGLEN; } function MoveHandler(e) { Xpos = e.pageX;Ypos = e.pageY; return true; } function MoveHandlerIE() { Xpos = window.event.x + document.body.scrollLeft; Ypos = window.event.y + document.body.scrollTop; } if (isNetscape) { document.captureEvents(Event.MOUSEMOVE); document.onMouseMove = MoveHandler; } else { document.onmousemove = MoveHandlerIE; } function vec(X, Y){ this.X = X; this.Y = Y;} function springForce(i, j, spring){ var dx = (dots[i].X - dots[j].X); var dy = (dots[i].Y - dots[j].Y); var len = Math.sqrt(dx*dx + dy*dy); if (len > SEGLEN) { var springF = SPRINGK * (len - SEGLEN); spring.X += (dx / len) * springF; spring.Y += (dy / len) * springF; }} function animate() { var start = 0; if (followmouse) { dots[0].X = Xpos; dots[0].Y = Ypos; start = 1;} for (i = start ; i < nDots; i++ ) { var spring = new vec(0, 0); if (i > 0) { springForce(i-1, i, spring);} if (i < (nDots - 1)) { springForce(i+1, i, spring);} var resist = new vec(-dots[i].dx * RESISTANCE, -dots[i].dy * RESISTANCE); var accel = new vec((spring.X + resist.X)/ MASS, (spring.Y + resist.Y)/ MASS + GRAVITY); dots[i].dx += (DELTAT * accel.X); dots[i].dy += (DELTAT * accel.Y); if (Math.abs(dots[i].dx) < STOPVEL &&Math.abs(dots[i].dy) < STOPVEL &&Math.abs(accel.X) < STOPACC &&Math.abs(accel.Y) < STOPACC) { dots[i].dx = 0; dots[i].dy = 0;} dots[i].X += dots[i].dx; dots[i].Y += dots[i].dy; var height, width; if (isNetscape) { height = window.innerHeight + document.scrollTop; width = window.innerWidth + document.scrollLeft; } else { height = document.body.clientHeight + document.body.scrollTop; width = document.body.clientWidth + document.body.scrollLeft;} if (dots[i].Y >= height - DOTSIZE - 1) { if (dots[i].dy > 0) { dots[i].dy = BOUNCE * -dots[i].dy;} dots[i].Y = height - DOTSIZE - 1;} if (dots[i].X >= width - DOTSIZE) { if (dots[i].dx > 0) { dots[i].dx = BOUNCE * -dots[i].dx;} dots[i].X = width - DOTSIZE - 1;} if (dots[i].X < 0) { if (dots[i].dx < 0) { dots[i].dx = BOUNCE * -dots[i].dx;} dots[i].X = 0;} dots[i].obj.left = dots[i].X; dots[i].obj.top = dots[i].Y; }} // End --> </script> </body> </html>
<endspoiler>
За курсором летают круглые часы с календарём!
<spoiler>
Посмотреть
<html> <head> <title>Часы круглые</title> </head> <body> <SCRIPT language=JavaScript> dCol='0099FF';//Цвет календаря. fCol='00FF00';//Цвет цифреблата. sCol='FF0000';//Цвет секундной стрелки. mCol='FFFF00';//Цвет минутной стрелки. hCol='FFFF00';//Цвет часовой стрелки. ClockHeight=40; ClockWidth=40; ClockFromMouseY=0; ClockFromMouseX=100; /*Календарь дни недели месяца, при необходимости можно задать другой язык и другой текст*/ d=new Array("Сегодня воскресенье","Сегодня понедельник","Сегодня вторник","Сегодня среда","Сегодня четверг","Сегодня пятница","Сегодня субота"); m=new Array("января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"); date=new Date(); day=date.getDate(); year=date.getYear(); if (year < 2000) year=year+1900; TodaysDate=" "+d[date.getDay()]+" "+day+" "+m[date.getMonth()]+" "+year; D=TodaysDate.split(''); H='...'; H=H.split(''); M='....'; M=M.split(''); S='.....'; S=S.split(''); Face='1 2 3 4 5 6 7 8 9 10 11 12'; //font='Arial'; font='Verdana'; size=1; speed=0.6; ns=(document.layers); ie=(document.all); Face=Face.split(' '); n=Face.length; a=size*10; ymouse=0; xmouse=0; scrll=0; props="<font face="+font+" size="+size+" color="+fCol+"><B>"; props2="<font face="+font+" size="+size+" color="+dCol+"><B>"; Split=360/n; Dsplit=360/D.length; HandHeight=ClockHeight/4.5 HandWidth=ClockWidth/4.5 HandY=-7; HandX=-2.5; scrll=0; step=0.06; currStep=0; y=new Array();x=new Array();Y=new Array();X=new Array(); for (i=0; i < n; i++){y[i]=0;x[i]=0;Y[i]=0;X[i]=0} Dy=new Array();Dx=new Array();DY=new Array();DX=new Array(); for (i=0; i < D.length; i++){Dy[i]=0;Dx[i]=0;DY[i]=0;DX[i]=0} if (ns){ for (i=0; i < D.length; i++) document.write('<layer name="nsDate'+i+'" top=0 left=0 height='+a+' width='+a+'><center>'+props2+D[i]+'</font></center></layer>'); for (i=0; i < n; i++) document.write('<layer name="nsFace'+i+'" top=0 left=0 height='+a+' width='+a+'><center>'+props+Face[i]+'</font></center></layer>'); for (i=0; i < S.length; i++) document.write('<layer name=nsSeconds'+i+' top=0 left=0 width=15 height=15><font face=Arial size=3 color='+sCol+'><center><b>'+S[i]+'</b></center></font></layer>'); for (i=0; i < M.length; i++) document.write('<layer name=nsMinutes'+i+' top=0 left=0 width=15 height=15><font face=Arial size=3 color='+mCol+'><center><b>'+M[i]+'</b></center></font></layer>'); for (i=0; i < H.length; i++) document.write('<layer name=nsHours'+i+' top=0 left=0 width=15 height=15><font face=Arial size=3 color='+hCol+'><center><b>'+H[i]+'</b></center></font></layer>'); } if (ie){ document.write('<div id="Od" style="position:absolute;top:0px;left:0px"><div style="position:relative">'); for (i=0; i < D.length; i++) document.write('<div id="ieDate" style="position:absolute;top:0px;left:0;height:'+a+';width:'+a+';text-align:center">'+props2+D[i]+'</B></font></div>'); document.write('</div></div>'); document.write('<div id="Of" style="position:absolute;top:0px;left:0px"><div style="position:relative">'); for (i=0; i < n; i++) document.write('<div id="ieFace" style="position:absolute;top:0px;left:0;height:'+a+';width:'+a+';text-align:center">'+props+Face[i]+'</B></font></div>'); document.write('</div></div>'); document.write('<div id="Oh" style="position:absolute;top:0px;left:0px"><div style="position:relative">'); for (i=0; i < H.length; i++) document.write('<div id="ieHours" style="position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+hCol+';text-align:center;font-weight:bold">'+H[i]+'</div>'); document.write('</div></div>'); document.write('<div id="Om" style="position:absolute;top:0px;left:0px"><div style="position:relative">'); for (i=0; i < M.length; i++) document.write('<div id="ieMinutes" style="position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+mCol+';text-align:center;font-weight:bold">'+M[i]+'</div>'); document.write('</div></div>') document.write('<div id="Os" style="position:absolute;top:0px;left:0px"><div style="position:relative">'); for (i=0; i < S.length; i++) document.write('<div id="ieSeconds" style="position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+sCol+';text-align:center;font-weight:bold">'+S[i]+'</div>'); document.write('</div></div>') } (ns)?window.captureEvents(Event.MOUSEMOVE):0; function Mouse(evnt){ ymouse = (ns)?evnt.pageY+ClockFromMouseY-(window.pageYOffset):event.y+ClockFromMouseY; xmouse = (ns)?evnt.pageX+ClockFromMouseX:event.x+ClockFromMouseX; } (ns)?window.onMouseMove=Mouse:document.onmousemove=Mouse; function ClockAndAssign(){ time = new Date (); secs = time.getSeconds(); sec = -1.57 + Math.PI * secs/30; mins = time.getMinutes(); min = -1.57 + Math.PI * mins/30; hr = time.getHours(); hrs = -1.575 + Math.PI * hr/6+Math.PI*parseInt(time.getMinutes())/360; if (ie){ Od.style.top=window.document.body.scrollTop; Of.style.top=window.document.body.scrollTop; Oh.style.top=window.document.body.scrollTop; Om.style.top=window.document.body.scrollTop; Os.style.top=window.document.body.scrollTop; } for (i=0; i < n; i++){ var F=(ns)?document.layers['nsFace'+i]:ieFace[i].style; F.top=y[i] + ClockHeight*Math.sin(-1.0471 + i*Split*Math.PI/180)+scrll; F.left=x[i] + ClockWidth*Math.cos(-1.0471 + i*Split*Math.PI/180); } for (i=0; i < H.length; i++){ var HL=(ns)?document.layers['nsHours'+i]:ieHours[i].style; HL.top=y[i]+HandY+(i*HandHeight)*Math.sin(hrs)+scrll; HL.left=x[i]+HandX+(i*HandWidth)*Math.cos(hrs); } for (i=0; i < M.length; i++){ var ML=(ns)?document.layers['nsMinutes'+i]:ieMinutes[i].style; ML.top=y[i]+HandY+(i*HandHeight)*Math.sin(min)+scrll; ML.left=x[i]+HandX+(i*HandWidth)*Math.cos(min); } for (i=0; i < S.length; i++){ var SL=(ns)?document.layers['nsSeconds'+i]:ieSeconds[i].style; SL.top=y[i]+HandY+(i*HandHeight)*Math.sin(sec)+scrll; SL.left=x[i]+HandX+(i*HandWidth)*Math.cos(sec); } for (i=0; i < D.length; i++){ var DL=(ns)?document.layers['nsDate'+i]:ieDate[i].style; DL.top=Dy[i] + ClockHeight*1.5*Math.sin(currStep+i*Dsplit*Math.PI/180)+scrll; DL.left=Dx[i] + ClockWidth*1.5*Math.cos(currStep+i*Dsplit*Math.PI/180); } currStep-=step; } function Delay(){ scrll=(ns)?window.pageYOffset:0; Dy[0]=Math.round(DY[0]+=((ymouse)-DY[0])*speed); Dx[0]=Math.round(DX[0]+=((xmouse)-DX[0])*speed); for (i=1; i < D.length; i++){ Dy[i]=Math.round(DY[i]+=(Dy[i-1]-DY[i])*speed); Dx[i]=Math.round(DX[i]+=(Dx[i-1]-DX[i])*speed); } y[0]=Math.round(Y[0]+=((ymouse)-Y[0])*speed); x[0]=Math.round(X[0]+=((xmouse)-X[0])*speed); for (i=1; i < n; i++){ y[i]=Math.round(Y[i]+=(y[i-1]-Y[i])*speed); x[i]=Math.round(X[i]+=(x[i-1]-X[i])*speed); } ClockAndAssign(); setTimeout('Delay()',20); } if (ns||ie)window.onload=Delay; </SCRIPT> </body> </html>
<endspoiler>
Вокруг курсора по эллипсу летают разноцветные точки
<spoiler>
Посмотреть
<html> <head> <title>Разноцветные точки бегают вокруг курсора по эллипсойдной орбите.</title> <SCRIPT language=JavaScript> <!-- function MM_reloadPage(init) { //reloads the window if Nav4 resized if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) { document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }} else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload(); } MM_reloadPage(true); // --> </SCRIPT> </head> <body> <LAYER CLIP="0,0,1,1" BGCOLOR="#ffffff" VISIBILITY="SHOW" TOP="10" LEFT="10" NAME="a0"></LAYER><LAYER CLIP="0,0,1,1" BGCOLOR="#fff000" VISIBILITY="SHOW" TOP="10" LEFT="10" NAME="a1"></LAYER><LAYER CLIP="0,0,1,1" BGCOLOR="#ffa000" VISIBILITY="SHOW" TOP="10" LEFT="10" NAME="a2"></LAYER><LAYER CLIP="0,0,1,1" BGCOLOR="#ff00ff" VISIBILITY="SHOW" TOP="10" LEFT="10" NAME="a3"></LAYER><LAYER CLIP="0,0,1,1" BGCOLOR="#00ff00" VISIBILITY="SHOW" TOP="10" LEFT="10" NAME="a4"></LAYER><LAYER CLIP="0,0,1,1" BGCOLOR="#FF00FF" VISIBILITY="SHOW" TOP="10" LEFT="10" NAME="a5"></LAYER><LAYER CLIP="0,0,1,1" BGCOLOR="#FF0000" VISIBILITY="SHOW" TOP="10" LEFT="10" NAME="a6"></LAYER><LAYER CLIP="0,0,2,2" BGCOLOR="#ffffff" VISIBILITY="SHOW" TOP="10" LEFT="10" NAME="a7"></LAYER><LAYER CLIP="0,0,2,2" BGCOLOR="#fff000" VISIBILITY="SHOW" TOP="10" LEFT="10" NAME="a8"></LAYER><LAYER CLIP="0,0,2,2" BGCOLOR="#ffa000" VISIBILITY="SHOW" TOP="10" LEFT="10" NAME="a9"></LAYER><LAYER CLIP="0,0,2,2" BGCOLOR="#ff00ff" VISIBILITY="SHOW" TOP="10" LEFT="10" NAME="a10"></LAYER><LAYER CLIP="0,0,2,2" BGCOLOR="#00ff00" VISIBILITY="SHOW" TOP="10" LEFT="10" NAME="a11"></LAYER><LAYER CLIP="0,0,2,2" BGCOLOR="#0000ff" VISIBILITY="SHOW" TOP="10" LEFT="10" NAME="a12"></LAYER><LAYER CLIP="0,0,3,3" BGCOLOR="#FF0000" VISIBILITY="SHOW" TOP="10" LEFT="10" NAME="a13"></LAYER> <DIV id=starsDiv style="LEFT: 0px; POSITION: absolute; TOP: 0px"> <DIV style="FONT-SIZE: 1px; BACKGROUND: #ffffff; VISIBILITY: visible; WIDTH: 1px; POSITION: relative; HEIGHT: 1px"></DIV><DIV style="FONT-SIZE: 1px; BACKGROUND: #fff000; VISIBILITY: visible; WIDTH: 1px; POSITION: relative; HEIGHT: 1px"></DIV><DIV style="FONT-SIZE: 1px; BACKGROUND: #ffa000; VISIBILITY: visible; WIDTH: 1px; POSITION: relative; HEIGHT: 1px"></DIV><DIV style="FONT-SIZE: 1px; BACKGROUND: #ff00ff; VISIBILITY: visible; WIDTH: 1px; POSITION: relative; HEIGHT: 1px"></DIV><DIV style="FONT-SIZE: 1px; BACKGROUND: #00ff00; VISIBILITY: visible; WIDTH: 1px; POSITION: relative; HEIGHT: 1px"></DIV><DIV style="FONT-SIZE: 1px; BACKGROUND: #0000ff; VISIBILITY: visible; WIDTH: 1px; POSITION: relative; HEIGHT: 1px"></DIV><DIV style="FONT-SIZE: 1px; BACKGROUND: #ff0000; VISIBILITY: visible; WIDTH: 1px; POSITION: relative; HEIGHT: 1px"></DIV><DIV style="FONT-SIZE: 2px; BACKGROUND: #ffffff; VISIBILITY: visible; WIDTH: 2px; POSITION: relative; HEIGHT: 2px"></DIV><DIV style="FONT-SIZE: 2px; BACKGROUND: #fff000; VISIBILITY: visible; WIDTH: 2px; POSITION: relative; HEIGHT: 2px"></DIV><DIV style="FONT-SIZE: 2px; BACKGROUND: #ffa000; VISIBILITY: visible; WIDTH: 2px; POSITION: relative; HEIGHT: 2px"></DIV><DIV style="FONT-SIZE: 2px; BACKGROUND: #ff00ff; VISIBILITY: visible; WIDTH: 2px; POSITION: relative; HEIGHT: 2px"></DIV><DIV style="FONT-SIZE: 2px; BACKGROUND: #00ff00; VISIBILITY: visible; WIDTH: 2px; POSITION: relative; HEIGHT: 2px"></DIV><DIV style="FONT-SIZE: 2px; BACKGROUND: #0000ff; VISIBILITY: visible; WIDTH: 2px; POSITION: relative; HEIGHT: 2px"></DIV><DIV style="FONT-SIZE: 3px; BACKGROUND: #ff0000; VISIBILITY: visible; WIDTH: 3px; POSITION: relative; HEIGHT: 3px"></DIV></DIV> <SCRIPT language=JavaScript> var Clrs = new Array(6); Clrs[0] = 'ff0000'; Clrs[1] = '00ff00'; Clrs[2] = '000aff'; Clrs[3] = 'ff00ff'; Clrs[4] = 'fff000'; Clrs[5] = 'fffff0'; var yBase = 200; var xBase = 200; var step; var currStep = 0; var Xpos = 1; var Ypos = 1; var Xs = 200; var Ys = 400; if (document.layers) { window.captureEvents(Event.MOUSEMOVE); } if (document.all) { function MoveHandler() { Xpos = document.body.scrollLeft+event.x; Ypos = document.body.scrollTop+event.y; } document.onmousemove = MoveHandler; } else if (document.layers) { function xMoveHandler(evnt) { Xpos = evnt.pageX; Ypos = evnt.pageY; } window.onMouseMove = xMoveHandler; } function Comet() { if (document.all) { yBase = window.document.body.offsetHeight / 4; xBase = window.document.body.offsetWidth / 4; } else if (document.layers) { yBase = window.innerHeight / 4; xBase = window.innerWidth / 4; } if (document.all) { for ( i = 0 ; i < starsDiv.all.length ; i++ ) { step = 3; starsDiv.all[i].style.top = Ypos + yBase*Math.cos((currStep + i*4)/12)*Math.cos(0.7+currStep/200); starsDiv.all[i].style.left = Xpos + xBase*Math.sin((currStep + i*3)/10)*Math.sin(8.2+currStep/400); for (ai = 0; ai < Clrs.length; ai++) { var c=Math.round(Math.random()*[ai]); } starsDiv.all[i].style.background = Clrs[c]; } } else if (document.layers) { for ( j = 0 ; j < 14 ; j++ ) { //number of NS layers! step = 6; var templayer = "a"+j; document.layers[templayer].top = Ypos + yBase*Math.cos((currStep + j*4)/12)*Math.cos(0.7+currStep/200); document.layers[templayer].left = Xpos + xBase*Math.sin((currStep + j*3)/10)*Math.sin(8.2+currStep/400); for (aj=0; aj < Clrs.length; aj++) { var c=Math.round(Math.random()*[aj]); } document.layers[templayer].bgColor = Clrs[c]; } } currStep += step; setTimeout("Comet()", 5); } Comet(); </SCRIPT> </body> </html>
<endspoiler>
При движении курсора возле него мерцает звездочка
<spoiler>
Посмотреть
<html> <head> <title>Поблескивающие около курсора огоньки при его движении.</title> <STYLE type=text/css> .s1 {FONT-SIZE: 10pt; VISIBILITY: hidden; COLOR: blue; POSITION: absolute} .s2 { FONT-SIZE: 18pt; VISIBILITY: hidden; COLOR: red; POSITION: absolute} .s3 { FONT-SIZE: 14pt; VISIBILITY: hidden; COLOR: gold; POSITION: absolute} .s4 { FONT-SIZE: 12pt; VISIBILITY: hidden; COLOR: lime; POSITION: absolute} </STYLE> </head> <body> <DIV class=s1 id=div1>*</DIV> <DIV class=s2 id=div2>*</DIV> <DIV class=s3 id=div3>*</DIV> <DIV class=s4 id=div4>*</DIV> <SCRIPT language=javascript type=text/javascript> var nav = (document.layers); var tmr = null; var spd = 50; var x = 0; var x_offset = 5; var y = 0; var y_offset = 15; if(nav) document.captureEvents(Event.MOUSEMOVE); document.onmousemove = get_mouse; function get_mouse(e) { x = (nav) ? e.pageX : event.clientX+document.body.scrollLeft; y = (nav) ? e.pageY : event.clientY+document.body.scrollTop; x += x_offset; y += y_offset; beam(1); } function beam(n) { if(n<5) { if(nav) { eval("document.div"+n+".top="+y); eval("document.div"+n+".left="+x); eval("document.div"+n+".visibility='visible'"); } else { eval("div"+n+".style.top="+y); eval("div"+n+".style.left="+x); eval("div"+n+".style.visibility='visible'"); } n++; tmr=setTimeout("beam("+n+")",spd); } else { clearTimeout(tmr); fade(4); } } function fade(n) { if(n>0) { if(nav)eval("document.div"+n+".visibility='hidden'"); else eval("div"+n+".style.visibility='hidden'"); n--; tmr=setTimeout("fade("+n+")",spd); } else clearTimeout(tmr); } // --> </SCRIPT> </body> </html>
<endspoiler>
Курсор с картинкой
<spoiler>
Посмотреть
<html> <head> Курсор с картинкой <title>Курсор с картинкой</title> <script language="JavaScript"> var Netscape=(navigator.appName.indexOf("Netscape") != -1); function Move(e) { if (!document.getElementById) return; obj=document.getElementById("mouse"); if (Netscape) event=e; if (event.pageX) { // Netscape... xpointer=event.pageX; ypointer=event.pageY; } else if (event.x) { // Internet Explorer... xpointer=event.x; ypointer=event.y; } obj.style.left=xpointer - 55; obj.style.top=ypointer - 55; } function Setup() { if (!document.getElementById) return; if (Netscape) document.captureEvents(Event.MOUSEMOVE); document.onmousemove=Move; } </script> </head> <body onLoad="Setup();" style="cursor:crosshair"> <div ID="mouse" style="position:absolute; left:50; top:50;"> <img src="http://superscripts.narod.ru/kur.png" width="50" height="50" alt="" border="0"> </div> </body> </html>
<endspoiler>
Троящийся при движении курсор
<spoiler>
Посмотреть
<html> <head> Троящийся при движении курсор <title>Троящийся при движении курсор</title> </head> <body> <script language="Javascript1.2"> <!-- var isNS = (navigator.appName == "Netscape"); layerRef = (isNS) ? "document" : "document.all"; styleRef = (isNS) ? "" : ".style"; var queue = new Array(); var NUM_OF_TRAIL_PARTS = 5 for (x=1; x < 6; x++) { eval("trailSpriteFrame" + x + " = new Image(28,36);"); eval("trailSpriteFrame" + x + ".src = 'http://superscripts.narod.ru/maus.gif';"); } function trailSpriteObj(anID) { this.trailSpriteID = "trailSprite" + anID; this.imgRef = "trailSprite" + anID + "img"; this.currentFrame = 1; this.animateTrailSprite = animateTrailSprite; } function animateTrailSprite() { if (this.currentFrame <6 ) { if (isNS) {eval("document." + this.trailSpriteID +".document['"+ this.imgRef + "'].src = trailSpriteFrame" + this.currentFrame + ".src");} else {eval("document['" + this.imgRef + "'].src = trailSpriteFrame" + this.currentFrame + ".src"); } this.currentFrame ++; } else {eval(layerRef + '.' + this.trailSpriteID + styleRef + '.visibility = "hidden"'); } } function processAnim() { for(x=0; x < NUM_OF_TRAIL_PARTS; x++) queue[x].animateTrailSprite(); } function processMouse(e) { currentObj = shuffleQueue(); if (isNS) {eval("document." + currentObj + ".left = e.pageX ;"); eval("document." + currentObj + ".top = e.pageY;"); } else {eval("document.all." + currentObj + ".style.pixelLeft = event.clientX + document.body.scrollLeft;"); eval("document.all." + currentObj + ".style.pixelTop = event.clientY + document.body.scrollTop;"); } } function shuffleQueue() { lastItemPos = queue.length - 1; lastItem = queue[lastItemPos]; for (i = lastItemPos; i>0; i--) queue[i] = queue[i-1]; queue[0] = lastItem; queue[0].currentFrame = 1; eval(layerRef + '.' + queue[0].trailSpriteID + styleRef + '.visibility = "visible"'); return queue[0].trailSpriteID; } function init() { for(x=0; x<NUM_OF_TRAIL_PARTS; x++) queue[x] = new trailSpriteObj(x+1) ; if (isNS) { document.captureEvents(Event.MOUSEMOVE); } document.onmousemove = processMouse; setInterval("processAnim();",25); } window.onload = init; //--> </script> <div id="trailSprite1" style="position: absolute; height:28px; width:36px;z-index: 100"><img src="http://superscripts.narod.ru/maus.gif" border="0" name="trailSprite1img"></div> <div id="trailSprite2" style="position: absolute; height:28px; width:26px;z-index: 10"><img src="http://superscripts.narod.ru/maus.gif" border="0" name="trailSprite2img"></div> <div id="trailSprite3" style="position: absolute; height:28px; width:36px;z-index: 10"><img src="http://superscripts.narod.ru/maus.gif" border="0" name="trailSprite3img"></div> <div id="trailSprite4" style="position: absolute; height:28px; width:36px;z-index: 10"><img src="http://superscripts.narod.ru/maus.gif" border="0" name="trailSprite4img"></div> <div id="trailSprite5" style="position: absolute; height:28px; width:36px;z-index: 10"><img src="http://superscripts.narod.ru/maus.gif" border="0" name="trailSprite5img"></div> </body> </html>
<endspoiler>
Снежинки, летающие за курсором
<spoiler>
Посмотреть
<html> <head> <title>Снежинки, летающие за курсором</title> </head> Снежинки, летающие за курсором <body color=green> <div id="dot0" style="HEIGHT: 15px; POSITION: absolute; VISIBILITY: hidden; WIDTH: 15px"><dd><img border="0" src="http://superscripts.narod.ru/snegok.gif"></dd></div> <div id="dot1" style="HEIGHT: 15px; POSITION: absolute; WIDTH: 15px"><dd><img border="0" src="snegok.gif"></dd></div> <div id="dot2" style="HEIGHT: 15px; POSITION: absolute; WIDTH: 15px"><dd><img border="0" src="snegok.gif"></dd></div> <div id="dot3" style="HEIGHT: 15px; POSITION: absolute; WIDTH: 15px"><dd><img border="0" src="snegok.gif"></dd></div> <div id="dot4" style="HEIGHT: 15px; POSITION: absolute; WIDTH: 15px"><dd><img border="0" src="snegok.gif"></dd></div> <div id="dot5" style="HEIGHT: 15px; POSITION: absolute; WIDTH: 15px"><dd><img border="0" src="snegok.gif"></dd></div> <div id="dot6" style="HEIGHT: 15px; POSITION: absolute; WIDTH: 15px"><dd><img border="0" src="snegok.gif"></dd></div> <script language=JavaScript> <!-- hide code var nDots = 7; var Xpos = 0; var Ypos = 0; var DELTAT = .01; var SEGLEN = 10; var SPRINGK = 10; var MASS = 1; var GRAVITY = 50; var RESISTANCE = 10; var STOPVEL = 0.1; var STOPACC = 0.1; var DOTSIZE = 10; var BOUNCE = 0.75; var isNetscape = navigator.appName=="Netscape"; var followmouse = true; init(); function init() { var i = 0; dots = new Array(); for (i = 0; i < nDots; i++) { dots[i] = new dot(i); } if (!isNetscape) { setInitPositions() } for (i = 0; i < nDots; i++) { dots[i].obj.left = dots[i].X; dots[i].obj.top = dots[i].Y; } if (isNetscape) { startanimate(); } else { setTimeout("startanimate()", 3000); } } function dot(i) { this.X = Xpos; this.Y = Ypos; this.dx = 0; this.dy = 0; if (isNetscape) { this.obj = eval("document.dot" + i); } else { this.obj = eval("dot" + i + ".style"); } } function startanimate() { setInterval("animate()", 20); } function setInitPositions() { var startloc = document.all.tags("LI"); var i = 0; for (i = 0; i < startloc.length; i++) { dots[i+1].X = startloc[i].offsetLeft + startloc[i].offsetParent.offsetLeft; dots[i+1].Y = startloc[i].offsetTop + startloc[i].offsetParent.offsetTop + DOTSIZE/2; } dots[0].X = dots[1].X; dots[0].Y = dots[1].Y - SEGLEN; } function MoveHandler(e) { Xpos = e.pageX; Ypos = e.pageY; return true; } function MoveHandlerIE() { Xpos = window.event.x; Ypos = window.event.y; } if (isNetscape) { document.captureEvents(Event.MOUSEMOVE); document.onMouseMove = MoveHandler; } else { document.onmousemove = MoveHandlerIE; } function vec(X, Y) { this.X = X; this.Y = Y; } function springForce(i, j, spring) { var dx = (dots[i].X - dots[j].X); var dy = (dots[i].Y - dots[j].Y); var len = Math.sqrt(dx*dx + dy*dy); if (len > SEGLEN) { var springF = SPRINGK * (len - SEGLEN); spring.X += (dx / len) * springF; spring.Y += (dy / len) * springF; } } function animate() { var start = 0; if (followmouse) { dots[0].X = Xpos; dots[0].Y = Ypos; start = 1; } for (i = start ; i < nDots; i++ ) { var spring = new vec(0, 0); if (i > 0) { springForce(i-1, i, spring); } if (i < (nDots - 1)) { springForce(i+1, i, spring); } var resist = new vec(-dots[i].dx * RESISTANCE, -dots[i].dy * RESISTANCE); var accel = new vec((spring.X + resist.X)/ MASS, (spring.Y + resist.Y)/ MASS + GRAVITY); dots[i].dx += (DELTAT * accel.X); dots[i].dy += (DELTAT * accel.Y); if (Math.abs(dots[i].dx) < STOPVEL && Math.abs(dots[i].dy) < STOPVEL && Math.abs(accel.X) < STOPACC && Math.abs(accel.Y) < STOPACC) { dots[i].dx = 0; dots[i].dy = 0; } dots[i].X += dots[i].dx; dots[i].Y += dots[i].dy; var height, width; if (isNetscape) { height = window.innerHeight; width = window.innerWidth; } else { height = document.body.clientHeight; width = document.body.clientWidth; } if (dots[i].X < 0) { if (dots[i].dx < 0) { dots[i].dx = BOUNCE * -dots[i].dx; } dots[i].X = 0; } dots[i].obj.left = dots[i].X; dots[i].obj.top = dots[i].Y; } } // --> </SCRIPT> </body> </html>
<endspoiler>
Санта-клаус с оленями летают за курсором
<spoiler>
Посмотреть
<html> <head> Санта Клаус с оленями скользят за курсором <title>Санта Клаус с оленями скользят за курсором.</title> </head> <body> <div id="span0" style="position:absolute;visibility:hidden;"> <img src="http://superscripts.narod.ru/elch.gif"></div> <div id="span1" style="position:absolute;visibility:hidden;"> <img src="http://superscripts.narod.ru/elch.gif"></div> <div id="span2" style="position:absolute;visibility:hidden;"> <img src="http://superscripts.narod.ru/elch.gif"></div> <div id="span3" style="position:absolute;visibility:hidden;"> <img src="http://superscripts.narod.ru/elch.gif"></div> <div id="span4" style="position:absolute;visibility:hidden;"> <img src="http://superscripts.narod.ru/elch.gif"></div> <div id="span5" style="position:absolute;visibility:hidden;"> <img src="http://superscripts.narod.ru/elch.gif"></div> <div id="span6" style="position:absolute;visibility:hidden;"> <img src="http://superscripts.narod.ru/zuegel.gif"></div> <div id="span7" style="position:absolute;visibility:hidden;"> <img src="http://superscripts.narod.ru/santaclaus.gif"></div> <div id="span8" style="position:absolute;visibility:hidden;"> </div> <script language="JavaScript">var step=8 var stepbasic=8 var numberofimages=8 var spacebetweenimgs=32 var x,y var flag=0 var xpos=new Array() for (i=0;i<=8;i++) { xpos[i]=-100 } var ypos=new Array() for (i=0;i<=numberofimages;i++) { ypos[i]=-100 } function handlerMM(e) { x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY flag=1 } function initiatetracker() { if (document.all) { for (i=0; i<numberofimages; i++) { var thisspan=eval("span"+(i)+".style") thisspan.posLeft=xpos[i] thisspan.posTop=ypos[i] thisspan.visibility="visible" } makesnake() } if (document.layers) { for (i=0; i<numberofimages; i++) { var thisspan=eval("document.span"+i) thisspan.left=xpos[i] thisspan.top=ypos[i] thisspan.visibility="visible" } makesnake() } } function makesnake() { if (flag==1 && document.all) { for (i=numberofimages; i>=1; i--) { xpos[i]=xpos[i-1]+spacebetweenimgs ypos[i]=ypos[i-1] } xpos[0]=x+stepbasic ypos[0]=y for (i=0; i<numberofimages; i++) { var thisspan = eval("span"+(i)+".style") thisspan.posLeft=xpos[i] thisspan.posTop=ypos[i] } } else if (flag==1 && document.layers) { for (i=numberofimages; i>=1; i--) { xpos[i]=xpos[i-1]+spacebetweenimgs ypos[i]=ypos[i-1] } xpos[0]=x+stepbasic ypos[0]=y for (i=0; i<numberofimages; i++) { var thisspan = eval("document.span"+i) thisspan.left=xpos[i] thisspan.top=ypos[i] } } var timer=setTimeout("makesnake()",30) } if (document.layers){ document.captureEvents(Event.MOUSEMOVE); } document.onmousemove=handlerMM; window.onload=initiatetracker </script> </body> </html>
<endspoiler>
Шарики, летающие за курсором (отбиваются от стенок)
<spoiler>
Посмотреть
<html> <head> Шарики, летающие за курсором (отбиваются от стенок) <title>Шарики, летающие за курсором (отбиваются от стенок)</title> </head> <body> <div id="dot0" style="position: absolute; visibility: hidden; height: 11; width: 11;"><img src="http://superscripts.narod.ru/bullet.gif"></div> <div id="dot1" style="position: absolute; height: 11; width: 11;"><img src="http://superscripts.narod.ru/bullet.gif"></div> <div id="dot2" style="position: absolute; height: 11; width: 11;"><img src="http://superscripts.narod.ru/bullet.gif"></div> <div id="dot3" style="position: absolute; height: 11; width: 11;"><img src="http://superscripts.narod.ru/bullet.gif"></div> <div id="dot4" style="position: absolute; height: 11; width: 11;"><img src="http://superscripts.narod.ru/bullet.gif"></div> <div id="dot5" style="position: absolute; height: 11; width: 11;"><img src="http://superscripts.narod.ru/bullet.gif"></div> <div id="dot6" style="position: absolute; height: 11; width: 11;"><img src="http://superscripts.narod.ru/bullet.gif"></div> <script LANGUAGE="JavaScript"> <!-- // hide code // for fix which makes it work when the page is scrolled var nDots = 7; if (document.all&&window.print) document.body.style.cssText="overflow-x:hidden;overflow-y:scroll" var Xpos = 0; var Ypos = 0; // fixed time step, no relation to real time var DELTAT = .01; // size of one spring in pixels var SEGLEN = 10; // spring constant, stiffness of springs var SPRINGK = 10; // all the physics is bogus, just picked stuff to // make it look okay var MASS = 1; var GRAVITY = 50; var RESISTANCE = 10; // stopping criterea to prevent endless jittering // doesn't work when sitting on bottom since floor // doesn't push back so acceleration always as big // as gravity var STOPVEL = 0.1; var STOPACC = 0.1; var DOTSIZE = 11; // BOUNCE is percent of velocity retained when // bouncing off a wall var BOUNCE = 0.75; var isNetscape = navigator.appName=="Netscape"; // always on for now, could be played with to // let dots fall to botton, get thrown, etc. var followmouse = true; var dots = new Array(); init(); function init() { var i = 0; for (i = 0; i < nDots; i++) { dots[i] = new dot(i); } if (!isNetscape) { // I only know how to read the locations of the // <LI> items in IE //skip this for now // setInitPositions(dots) } // set their positions for (i = 0; i < nDots; i++) { dots[i].obj.left = dots[i].X; dots[i].obj.top = dots[i].Y; } if (isNetscape) { // start right away since they are positioned // at 0, 0 startanimate(); } else { // let dots sit there for a few seconds // since they're hiding on the real bullets setTimeout("startanimate()", 2000); } } function dot(i) { this.X = Xpos; this.Y = Ypos; this.dx = 0; this.dy = 0; if (isNetscape) { this.obj = eval("document.dot" + i); } else { this.obj = eval("dot" + i + ".style"); } } function startanimate() { setInterval("animate()", 20); } // This is to line up the bullets with actual LI tags on the page // Had to add -DOTSIZE to X and 2*DOTSIZE to Y for IE 5, not sure why // Still doesn't work great function setInitPositions(dots) { // initialize dot positions to be on top // of the bullets in the <ul> var startloc = document.all.tags("LI"); var i = 0; for (i = 0; i < startloc.length && i < (nDots - 1); i++) { dots[i+1].X = startloc[i].offsetLeft startloc[i].offsetParent.offsetLeft - DOTSIZE; dots[i+1].Y = startloc[i].offsetTop + startloc[i].offsetParent.offsetTop + 2*DOTSIZE; } // put 0th dot above 1st (it is hidden) dots[0].X = dots[1].X; dots[0].Y = dots[1].Y - SEGLEN; } // just save mouse position for animate() to use function MoveHandler(e) { Xpos = e.pageX; Ypos = e.pageY; return true; } // just save mouse position for animate() to use function MoveHandlerIE() { Xpos = window.event.x + document.body.scrollLeft; Ypos = window.event.y + document.body.scrollTop; } if (isNetscape) { document.captureEvents(Event.MOUSEMOVE); document.onMouseMove = MoveHandler; } else { document.onmousemove = MoveHandlerIE; } function vec(X, Y) { this.X = X; this.Y = Y; } // adds force in X and Y to spring for dot[i] on dot[j] function springForce(i, j, spring) { var dx = (dots[i].X - dots[j].X); var dy = (dots[i].Y - dots[j].Y); var len = Math.sqrt(dx*dx + dy*dy); if (len > SEGLEN) { var springF = SPRINGK * (len - SEGLEN); spring.X += (dx / len) * springF; spring.Y += (dy / len) * springF; } } function animate() { // dots[0] follows the mouse, // though no dot is drawn there var start = 0; if (followmouse) { dots[0].X = Xpos; dots[0].Y = Ypos; start = 1; } for (i = start ; i < nDots; i++ ) { var spring = new vec(0, 0); if (i > 0) { springForce(i-1, i, spring); } if (i < (nDots - 1)) { springForce(i+1, i, spring); } // air resisitance/friction var resist = new vec(-dots[i].dx * RESISTANCE, -dots[i].dy * RESISTANCE); // compute new accel, including gravity var accel = new vec((spring.X + resist.X)/ MASS, (spring.Y + resist.Y)/ MASS + GRAVITY); // compute new velocity dots[i].dx += (DELTAT * accel.X); dots[i].dy += (DELTAT * accel.Y); // stop dead so it doesn't jitter when nearly still if (Math.abs(dots[i].dx) < STOPVEL && Math.abs(dots[i].dy) < STOPVEL && Math.abs(accel.X) < STOPACC && Math.abs(accel.Y) < STOPACC) { dots[i].dx = 0; dots[i].dy = 0; } // move to new position dots[i].X += dots[i].dx; dots[i].Y += dots[i].dy; // get size of window var height, width; if (isNetscape) { height = window.innerHeight + document.scrollTop; width = window.innerWidth + document.scrollLeft; } else { height = document.body.clientHeight + document.body.scrollTop; width = document.body.clientWidth + document.body.scrollLeft; } // bounce of 3 walls (leave ceiling open) if (dots[i].Y >= height - DOTSIZE - 1) { if (dots[i].dy > 0) { dots[i].dy = BOUNCE * -dots[i].dy; } dots[i].Y = height - DOTSIZE - 1; } if (dots[i].X >= width - DOTSIZE) { if (dots[i].dx > 0) { dots[i].dx = BOUNCE * -dots[i].dx; } dots[i].X = width - DOTSIZE - 1; } if (dots[i].X < 0) { if (dots[i].dx < 0) { dots[i].dx = BOUNCE * -dots[i].dx; } dots[i].X = 0; } // move img to new position dots[i].obj.left = dots[i].X; dots[i].obj.top = dots[i].Y; } } // end code hiding --> </script> </body> </html>
<endspoiler>
Шары летают вокруг курсора то удаляясь, то приближаясь
<spoiler>
Посмотреть
<html> <head> Шары летают вокруг курсора то удаляясь, то приближаясь <title>Шары летают вокруг курсора то удаляясь, то приближаясь.</title> <style type=text/css> #a0 {z-index: 2000; left: -24px; WIDTH: 9px; CLIP: rect(0px 9px 9px 0px); position: absolute; TOP: -24px; height: 25px} #a1 {z-index: 2000; left: 96px; WIDTH: 9px; CLIP: rect(0px 9px 9px 0px); position: absolute; TOP: -24px; height: 25px} #a2 {z-index: 2000; left: 216px; WIDTH: 9px; CLIP: rect(0px 9px 9px 0px); position: absolute; TOP: -24px; height: 25px} #a3 {z-index: 2000; left: 338px; WIDTH: 9px; CLIP: rect(0px 9px 9px 0px); position: absolute; TOP: -24px; height: 25px} #a4 {z-index: 2000; left: 460px; WIDTH: 9px; CLIP: rect(0px 9px 9px 0px); position: absolute; TOP: -24px; height: 25px} #a5 {z-index: 2000; left: 640px; WIDTH: 9px; CLIP: rect(0px 9px 9px 0px); position: absolute; TOP: -24px; height: 25px} #a6 {z-index: 2000; left: -24px; WIDTH: 9px; CLIP: rect(0px 9px 9px 0px); position: absolute; TOP: -24px; height: 25px} #a7 {z-index: 2000; left: 200px; WIDTH: 9px; CLIP: rect(0px 9px 9px 0px); position: absolute; TOP: -24px; height: 25px} #a8 {z-index: 2000; left: 300px; WIDTH: 9px; CLIP: rect(0px 9px 9px 0px); position: absolute; TOP: -24px; height: 25px} #a9 {z-index: 2000; left: 600px; width: 9px; clip: rect(0px 9px 9px 0px); position: absolute; top: -24px; height: 25px} </style> </head> <body onload=startthedots()> <script language=JavaScript> <!-- window.onerror=null; netscape = (document.layers) ? 1:0; goodIE = (document.all) ? 1:0; document.onmousemove=MoveHandler; var gotthere = 0; var count = 0; var ietopcorner='' var ieleftcorner='' toplocation = new Array( 0,30,57,80,101,125,80,80,101,125,80,0 ); temptoplocation = new Array( 50,100,100,150,150,200,200,100,150,150,200,200,0 ); leftlocation = new Array( 0,292,318,181,181,217,263,318,181,181,217,263,-96 ); templeftlocation = new Array( 0,0,260,390,420,550,680,390,420,550,680,0 ); difftop = new Array( 0,0,0,0,0,0,0,0,0,0,0,0 ); diffleft = new Array( 0,0,0,0,0,0,0,0,0,0,0,0 ); questtop = -13; questleft2 = -96; if (netscape) { document.body=new Object() document.body.scrollTop='' document.body.scrollLeft='' window.captureEvents(Event.MOUSEMOVE); window.onMouseMove = MoveHandler; var layerstart = "document."; var layerleft = ".left"; var layertop = ".top"; var layerstyle = ""; var windowWidth = window.innerWidth; var windowHeight = window.innerHeight; } else if (goodIE) { ietopcorner=document.body.scrollTop ieleftcorner=document.body.scrollLeft layerstart = "document.all."; layerleft = ".left"; layertop = ".top"; layerstyle = ".style"; windowWidth=600; windowHeight=400; } // end error trapping var Ypos2 = 72; var Xpos2 = 72; function MoveHandler(e) { if (netscape || goodIE) { Xpos2 = (netscape)?e.pageX:event.x Ypos2 = (netscape)?e.pageY:event.y Xorigin = Xpos2; Yorigin = Ypos2; if (Ypos2 > windowHeight/2) { if (Xpos2 > windowWidth/2) { direction = 1;} else { direction = -1;} } else { if (Xpos2 > windowWidth/2) { direction = -1;} else { direction = 1;} } }} function startthedots() { if (goodIE) { windowWidth=document.body.clientWidth; windowHeight=document.body.clientHeight; } Xorigin = 204; Yorigin = 147; spin();run(); } var OrbitSize = 200; count=1; delay=100; direction = -1; Count = new Array ( 0, .63, 1.26, 1.89, 2.52, 3.15, 3.78, 4.41, 5.04, 5.67 ); Xpoint = new Array ( 0, .63, 1.26, 1.89, 2.52, 3.15, 3.78, 4.41, 5.04, 5.67 ); Ypoint = new Array ( 0, .63, 1.26, 1.89, 2.52, 3.15, 3.78, 4.41, 5.04, 5.67 ); var speed = -0.06; var offset = 1; function spin() { for ( j = 0 ; j <= 9 ; j++ ) { Count[j] = Count[j] + (speed*direction); Xpoint[j] = Xorigin + ((OrbitSize*Math.sin(Count[j])*offset)); Ypoint[j] = Yorigin + (OrbitSize*Math.cos(Count[j])); } setTimeout('spin()',3); } function run() { count++; for ( j = 0 ; j <= 9 ; j++ ) { difftop[j] = Ypoint[j] - temptoplocation[j]; diffleft[j] = Xpoint[j] - templeftlocation[j]; diff = 30; temptoplocation[j] = temptoplocation[j] + difftop[j]/diff; templeftlocation[j] = templeftlocation[j] + diffleft[j]/diff; eval(layerstart+"a"+j+layerstyle+layerleft+" = document.body.scrollLeft+templeftlocation["+j+"]"); eval(layerstart+"a"+j+layerstyle+layertop+" = document.body.scrollTop+temptoplocation["+j+"]"); } setTimeout('run()', 25) } badIE = 0; browserName = navigator.appName.substring(0,8); browserVer = parseFloat(navigator.appVersion); macintosh = navigator.userAgent.indexOf("Mac"); if (browserName == "Microsof") { if (macintosh != -1) { badIE = 1; } if (browserVer < 4) { badIE = 1; } } --> </script> <DIV id=a0 align=center><IMG height=9 src="http://superscripts.narod.ru/bullet.gif" width=9></DIV> <DIV id=a1 align=center><IMG height=9 src="http://superscripts.narod.ru/bullet.gif" width=9></DIV> <DIV id=a2 align=center><IMG height=9 src="http://superscripts.narod.ru/bullet.gif" width=9></DIV> <DIV id=a3 align=center><IMG height=9 src="http://superscripts.narod.ru/bullet.gif" width=9></DIV> <DIV id=a4 align=center><IMG height=9 src="http://superscripts.narod.ru/bullet.gif" width=9></DIV> <DIV id=a5 align=center><IMG height=9 src="http://superscripts.narod.ru/bullet.gif" width=9></DIV> <DIV id=a6 align=center><IMG height=9 src="http://superscripts.narod.ru/bullet.gif" width=9></DIV> <DIV id=a7 align=center><IMG height=9 src="http://superscripts.narod.ru/bullet.gif" width=9></DIV> <DIV id=a8 align=center><IMG height=9 src="http://superscripts.narod.ru/bullet.gif" width=9></DIV> <DIV id=a9 align=center><IMG height=9 src="http://superscripts.narod.ru/bullet.gif" width=9></DIV> </body> </html>
<endspoiler>