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

Js鼠標跟隨代碼小手點擊

2013-11-15 12:15:49  來源: 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-2013 電腦知識網 Computer Knowledge   All rights reserved.