zoukankan      html  css  js  c++  java
  • 鼠标按下左键随鼠标而移动,释放左键停止移动

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>reg</title>
    </head>
    <body>
        <script type="text/jscript">
            function move(event) {
                document.getElementById("no1").style.left = event.clientX;
                document.getElementById("no1").style.top = event.clientY;
            }
            document.onmouseup = function () {
                document.onmousemove = null;
            }
        </script>
        <style>
            #no1 {
                border: 4px;
                border-color: #F00;
                position: absolute;
                height: 165px;
                270px;
                border-style: solid;
                left: 68px;
                top: 197px;
            }
        </style>
        <div id="no1" onmousedown="document.onmousemove=move"></div>
    </body>
    </html>

  • 相关阅读:
    hdu 4739 Zhuge Liang's Mines DFS
    Uva 12304
    三角形的心
    最小路径覆盖的理解
    Codeforces Round #192 (Div. 2)
    Uva 11796 Dog Distance
    laravel框架session使用教程
    php session跨页面传递 session值丢失问题
    PHP 5.4中的traits特性
    PHP5.3 goto操作符介绍
  • 原文地址:https://www.cnblogs.com/wangtiantian/p/5045593.html
Copyright © 2011-2022 走看看