[JavaScript] 跟随鼠标的图片 →→→→→进入此内容的聊天室

来自 , 2020-12-29, 写在 JavaScript, 查看 109 次.
URL http://www.code666.cn/view/0060ef47
  1. <html>
  2. <head>
  3. <title>跟随鼠标的图像</title>
  4. </head>
  5. <body>
  6. <script language="JavaScript">
  7.         var newtop=0
  8.         var newleft=0
  9.         layerStyleRef="layer.style.";
  10.         layerRef="document.all";
  11.         styleSwitch=".style";
  12.         function doMouseMove()
  13.         {
  14.                 layerName = 'picture'
  15.                 eval('var curElement='+layerRef+'["'+layerName+'"]')
  16.                 eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"')
  17.                 eval('curElement'+styleSwitch+'.visibility="visible"')
  18.                 eval('newleft=document.body.clientWidth-curElement'+styleSwitch+'.pixelWidth')
  19.                 eval('newtop=document.body.clientHeight-curElement'+styleSwitch+'.pixelHeight')
  20.                 eval('height=curElement'+styleSwitch+'.height')
  21.                 eval('width=curElement'+styleSwitch+'.width')
  22.                 width=parseInt(width)
  23.                 height=parseInt(height)
  24.  
  25.                 if (event.clientX > (document.body.clientWidth - width))
  26.                 {
  27.                 newleft=document.body.clientWidth + document.body.scrollLeft- width
  28.                 }
  29.                 else{newleft=document.body.scrollLeft + event.clientX}
  30.  
  31.                 eval('curElement'+styleSwitch+'.pixelLeft=newleft')
  32.  
  33.                 if (event.clientY > (document.body.clientHeight - height))
  34.                 {
  35.                 newtop=document.body.clientHeight + document.body.scrollTop - height
  36.                 }
  37.                 else
  38.                 {
  39.                 newtop=document.body.scrollTop + event.clientY
  40.                 }
  41.                 eval('curElement'+styleSwitch+'.pixelTop=newtop')
  42.         }
  43.         document.onmousemove = doMouseMove;
  44.         document.write("<img ID=picture src='pic01.gif' Style='position:absolute;TOP:0pt;LEFT:0pt;Z-INDEX:2; visibility:hidden;'>");
  45.  
  46. </script>
  47. </body>
  48. </html>
  49.  

回复 "跟随鼠标的图片"

这儿你可以回复上面这条便签

captcha