虫虫技术在线--技术决定出路

当前位置: 首页 > 网络 > 建站运营 > 网页设计 >

源码:跟随鼠标的图片

时间:2010-08-29 09:55来源:虫虫技术在线收集整理 作者:虫虫编辑 点击:
html head meta http-equiv = Content-Type content = text/html;charset=gb2312 title 网页特效|JsCode.cn|---跟随鼠标的图片 / title script LANGUAGE = JavaScript var newtop = 0 var newleft = 0 if( navigator.appName ==Netscape){ layerSt

 

  1. <html> 
  2.  
  3. <head> 
  4. <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
  5. <title>网页特效|JsCode.cn|---跟随鼠标的图片</title> 
  6. <script LANGUAGE="JavaScript"> 
  7. var newtop=0 
  8. var newleft=0 
  9. if (navigator.appName == "Netscape") {  
  10. layerStyleRef="layer.";  
  11. layerRef="document.layers";  
  12. styleSwitch="";  
  13. }  
  14. else  
  15. {  
  16. layerStyleRef="layer.style.";  
  17. layerRef="document.all";  
  18. styleSwitch=".style";  
  19. }  
  20. function doMouseMove() {  
  21. layerName = 'iit' 
  22. eval('var curElement='+layerRef+'["'+layerName+'"]')  
  23. eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"')  
  24. eval('curElement'+styleSwitch+'.visibility="visible"')  
  25. eval('newleft=document.body.clientWidth-curElement'+styleSwitch+'.pixelWidth')  
  26. eval('newtop=document.body.clientHeight-curElement'+styleSwitch+'.pixelHeight')  
  27. eval('height=curElement'+styleSwitch+'.height')  
  28. eval('width=curElement'+styleSwitch+'.width')  
  29. width=parseInt(width)  
  30. height=parseInt(height)  
  31. if (event.clientX > (document.body.clientWidth - 5 - width))  
  32. {  
  33. newleft=document.body.clientWidth + document.body.scrollLeft - 5 - width  
  34. }  
  35. else  
  36. {  
  37. newleft=document.body.scrollLeft + event.clientX  
  38. }  
  39. eval('curElement'+styleSwitch+'.pixelLeft=newleft')  
  40. if (event.clientY > (document.body.clientHeight - 5 - height))  
  41. {  
  42. newtop=document.body.clientHeight + document.body.scrollTop - 5 - height  
  43. }  
  44. else  
  45. {  
  46. newtop=document.body.scrollTop + event.clientY  
  47. }  
  48. eval('curElement'+styleSwitch+'.pixelTop=newtop')  
  49. }  
  50. document.onmousemove = doMouseMove;  
  51. </script> 
  52. </head> 
  53.  
  54. <body> 
  55. <!-- 以下代码是设定此页的鼠标样式代码 --> 
  56. <script language="javascript"> 
  57. if (navigator.appName == "Netscape") {  
  58. }  
  59. else  
  60. {  
  61. document.write('<div ID=OuterDiv>')  
  62. document.write('<img ID=iit src="images/flag.gif" STYLE="position:absolute;TOP:5pt;LEFT:5pt;Z-INDEX:10;visibility:hidden;">')  
  63. document.write('</div>')  
  64. }  
  65. </script> 
  66. </body> 
  67.  
  68. </html> 

 

(责任编辑:admin)
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:点击我更换图片
栏目列表
推荐内容