zoukankan      html  css  js  c++  java
  • 鼠标事件(jQuery方法)

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" lang="en">

        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
            <title>鼠标事件</title>
            <script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
            <script type="text/javascript">
                $(function() {
                    $("input[type='button']")
                        .css("width", "280px")
                        .css("height", "100px")
                        .css("font-size", "24pt");

                    $("input[type='button']:eq(0)")
                        .mouseover(fnOver)
                        .mouseout(fnOut);

                    $("input[type='button']:eq(1)")
                        .click(function() {
                            $('h1').html('点击了鼠标!');
                        });

                    $("input[type='button']:eq(2)")
                        .dblclick(function() {
                            $('h1').html('双击了鼠标!');
                        });
                    $("input[type='button']:eq(3)")
                        .mousedown(function() {
                            $('h1').html('按下了鼠标!');
                        })
                        .mouseup(function() {
                            $('h1').html('松开了鼠标!');
                        });
                    $("div").mousemove(function() {
                        $("div").text(event.x + "," + event.y);
                    });
                });

                function fnOver() {
                    $("h1").html("鼠标移动到按钮上了!");
                }

                function fnOut() {
                    $("h1").html("鼠标移开了!");
                }

                function fnMove() {
                    $("div").text(event.x + "," + event.y);
                }
            </script>
        </head>

        <body>
            <h1></h1>
            <input type="button" value="测试悬停" />
            <input type="button" value="测试点击" />
            <input type="button" value="测试双击" />
            <input type="button" value="测试鼠标按键" />
            <div style="border: double 3px red; 400px; height: 300px;">
            </div>
        </body>

    </html>

  • 相关阅读:
    codeblocks 配置
    2020-7-28
    echarts markPoint在极坐标散点图中不显示value值
    Oracle cve 2020-14644 分析利用以及回显思路
    Openfire Admin Console SSRF&任意文件读取漏洞 CVE-2019-18394 CVE-2019-18393 poc
    Shiro 回显利用工具(burp
    java反序列化提取payload之Xray高级版的shiro回显poc的提取过程
    CVE-2020-3452 CISCO ASA远程任意文件读取 poc
    记事本陈列-历届数学建模大赛优秀论文(含国赛、美赛、研赛)目录
    懒人必备 |通过爬虫 筛选以及查看CSDN 满足相应积分的资源列表 简单好用
  • 原文地址:https://www.cnblogs.com/zhouguoshuai/p/8192207.html
Copyright © 2011-2022 走看看