zoukankan      html  css  js  c++  java
  • JS实现网页十字光标

    <html>
    <head>
    <title>在页面中显示十字光标</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head>
    <body>
    <div id="divleft"></div>
    <div id="divtop"></div>
    <script language="JavaScript">
    function move(){
     if (event.clientX<document.body.clientWidth-2)
      divtop.style.pixelLeft=document.body.scrollLeft+event.clientX+1;
     else divtop.style.pixelLeft=document.body.clientWidth-2;
     if (event.clientY<document.body.clientHeight-2)
      divleft.style.pixelTop=document.body.scrollTop+event.clientY+1;
    }
    function setstyle(n){
     var name=eval(n).style;
     name.position="absolute";
     name.left="0";
     name.top="0";
     if (n=="divleft"){
      name.height="2px";
      name.width=document.body.clientWidth;
     }
     if (n=="divtop"){
      name.width="2px";
      name.height=document.body.clientHeight;
     }
     name.backgroundColor="#6699cc";
     name.fontSize="0px";
    }
    setstyle("divleft");
    setstyle("divtop");
    document.onmousemove=move;
    </script>
    </body>
    </html>

  • 相关阅读:
    hdu 3791 二叉搜索树
    hdu 4041 Eliminate Witches! 栈和队列
    后缀数组讲解
    Theme Section HDU
    Wow! Such Doge! HDU
    Girls' research HDU
    吉哥系列故事――完美队形II HDU
    Best Reward HDU
    String Problem HDU
    最大最小表示法
  • 原文地址:https://www.cnblogs.com/softmans/p/7422928.html
Copyright © 2011-2022 走看看