熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

Js鼠標跟隨代碼小手點擊

2022-06-13   來源: JSP教程 

  <!DOCTYPE html PUBLIC "//WC//DTD XHTML Transitional//EN" "

<html xmlns=" <head> <meta httpequiv="ContentType" content="text/html; charset=utf" /> <title>可愛的鼠標跟隨</title> <style> html{ background:#;} bodyhtmlinput{ cursor:none;} bodyhtml{ height:%;} #cursor{ position:absolute; left:px; top:px; display:block;} </style> <script>  windowonload = function(){   var oCursor = documentgetElementById("cursor");   documentonmousemove=function (ev){    var oEvent=ev||event     oWidth = documentdocumentElementclientWidth     oHeight = documentdocumentElementclientHeight     scrollTop=documentdocumentElementscrollTop + oEventclientY     scrollLeft=documentdocumentElementscrollLeft + oEventclientX;    if(scrollTop > oHeightoCursoroffsetHeight){     oCursorstyletop = oHeightoCursoroffsetHeight+px;    }else if(scrollTop < ){     oCursorstyletop = ;    }else{     oCursorstyletop = scrollTop+px;    }    if(scrollLeft > oWidthoCursoroffsetWidth){     oCursorstyleleft = oWidthoCursoroffsetWidth+px;    }else{     oCursorstyleleft = scrollLeft+px;    }    documentonmousedown = function(){     oCursorinnerHTML = "<img src= />";      return false;    }    documentonmouseup = function(){     oCursorinnerHTML = "<img src= />";     }   };  } </script> </head> <body> <div id="cursor"><img src=" <input type="button" style="fontsize:px; margin:px;" value="點擊" onclick="windowopen()" /> </body> </html>  
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20597.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.