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

    <!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");
                });

                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="测试悬停" onmouseover="fnOver();" onmouseout="fnOut();" />
            <input type="button" value="测试点击" onclick="$('h1').html('点击了鼠标!');" />
            <input type="button" value="测试双击" ondblclick="$('h1').html('双击了鼠标!');" />
            <input type="button" value="测试鼠标按键" onmousedown="$('h1').html('按下了鼠标!');" onmouseup="$('h1').html('松开了鼠标!');" />
            <div style="border: double 3px red; 400px; height: 300px;" onmousemove="fnMove();">
            </div>
        </body>

    </html>

  • 相关阅读:
    字符串算法—正则表达式
    字符串算法—字符串搜索
    字符串算法—字典树
    字符串算法—字符串排序(下篇)
    字符串算法—字符串排序(上篇)
    图表算法—最短路径
    基本算法——前缀和与差分
    图论——图的表示
    基本算法——康托展开与逆康托展开
    基本算法——离散化
  • 原文地址:https://www.cnblogs.com/zhouguoshuai/p/8192201.html
Copyright © 2011-2022 走看看