《网页鼠标特效代码.doc》由会员分享,可在线阅读,更多相关《网页鼠标特效代码.doc(16页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、图片跟随鼠标 脚本说明:第一步:把如下代码加入区域中var newtop=0var newleft=0if (navigator.appName = Netscape) layerStyleRef=layer.;layerRef=document.layers;styleSwitch=;elselayerStyleRef=layer.style.;layerRef=document.all;styleSwitch=.style;function doMouseMove() layerName = iiteval(var curElement=+layerRef+layerName+)eval(
2、layerRef+layerName+styleSwitch+.visibility=hidden)eval(curElement+styleSwitch+.visibility=visible)eval(newleft=document.body.clientWidth-curElement+styleSwitch+.pixelWidth)eval(newtop=document.body.clientHeight-curElement+styleSwitch+.pixelHeight)eval(height=curElement+styleSwitch+.height)eval(width
3、=curElement+styleSwitch+.width)width=parseInt(width)height=parseInt(height)if (event.clientX (document.body.clientWidth - 5 - width)newleft=document.body.clientWidth + document.body.scrollLeft - 5 - widthelsenewleft=document.body.scrollLeft + event.clientXeval(curElement+styleSwitch+.pixelLeft=newle
4、ft)if (event.clientY (document.body.clientHeight - 5 - height)newtop=document.body.clientHeight + document.body.scrollTop - 5 - heightelsenewtop=document.body.scrollTop + event.clientYeval(curElement+styleSwitch+.pixelTop=newtop)document.onmousemove = doMouseMove;第二步:把如下代码加入区域中if (navigator.appName
5、= Netscape) elsedocument.write()document.write()document.write()鼠标放上去打开新页面脚本说明:第一步:把如下代码加入区域中function winopen () msg=open(update.htm,NewWindow,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=400,height=260);第二步:把如下代码加入区域中鼠标激活警告框脚本说明:把如下代码加入
6、区域中记住本站域名显示鼠标坐标脚本说明:第一步:把如下代码加入区域中: if (navigator.appName = Netscape) document.captureEvents(Event.MOUSEMOVE);document.onmousemove = netscapeMouseMove;function netscapeMouseMove(e) if (e.screenX != document.test.x.value & e.screenY != document.test.y.value) document.test.x.value = e.screenX;document
7、.test.y.value = e.screenY; function micro$oftMouseMove() if (window.event.x != document.test.x.value & window.event.y != document.test.y.value) document.test.x.value = window.event.x;document.test.y.value = window.event.y;X: Y: 第二步:把中内容改为:各种形状的鼠标脚本说明:第一步:把如下代码加入区域中 style=cursor:hand style=cursor:cro
8、sshair style=cursor:text style=cursor:wait style=cursor:move style=cursor:help style=cursor:e-resize style=cursor:n-resize style=cursor:nw-resize style=cursor:w-resize style=cursor:s-resize style=cursor:se-resize style=cursor:sw-resize 鼠标响应文字变色脚本说明:把如下代码加入区域中font face=arial size=3 onMouseOver=this.s
9、tyle.backgroundColor = red; 随鼠标的彩色字符脚本说明:第一步:把如下代码加入区域中.spanstyle COLOR: #0066ff; FONT-FAMILY: 隶书; FONT-SIZE: 14pt; FONT-WEIGHT: normal; POSITION: absolute; TOP: -50px; VISIBILITY: visible第二步:把如下代码加入区域中var message=欢 迎 光 临 javascript 精 彩 世 界 !;var x,y;var step=12;var flag=0;message=message.split();va
10、r xpos=new Array();for (i=0;i=message.length-1;i+) xposi=-50;var ypos=new Array();for (i=0;i=1; i-) xposi=xposi-1+step;yposi=yposi-1; xpos0=x+step;ypos0=y;for (i=0; i=1; i-) xposi=xposi-1+step;yposi=yposi-1; xpos0=x+step;ypos0=y;for (i=0; imessage.length-1; i+) var thisspan = eval(document.span+i);
11、thisspan.left=xposi;thisspan.top=yposi;thisspan.color=Math.random() * 255 * 255 * 255 + Math.random() * 255 * 255 + Math.random() * 255;for (i=0;i=message.length-1;i+) document.write();document.write(messagei); document.write();if (document.layers) document.captureEvents(Event.MOUSEMOVE);document.onmousemove = handlerMM;function pageonload() makesnake();window.setTimeout(pageonload();, 2);第三步:把改为