zoukankan      html  css  js  c++  java
  • Bind()事件

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
    </head>
    <body>
        <div id="content">
            外层div元素<br />
            <span>内层span元素</span><br />
            外层div元素
        </div>
        <div id="msg"></div>
        <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(function () {
                $("span").bind("click", mySpan = function (event, a, b) {
                    var txt = $("#msg").html() + "<p>内层span元素被单击<p/>";
                    $("#msg").html(txt);
                    //alert($(event.target));
                    event.stopPropagation();
                    start(event, a, b);
                    //return false;
                })
                $("span").trigger("click", ["5", "6"]);
                function start(event, a, b) {
                    alert(a);
                    alert(b);
                }
                $("#content").bind("click", { foo: "bar" }, myFun2 = function (event) {
                    var txt = $("#msg").html() + "<p>外层div元素被单击<p/>";
                    $("#msg").html(txt);
                    alert(event.data.foo);
                    event.stopPropagation();
                });
                $("body").trigger("clcik");
                $("body").bind("click", function () {
                    var txt = $("#msg").html() + "<p>body元素被单击<p/>";
                    $("#msg").html(txt);
                    event.stopPropagation();
                });
    
    
                $("#btn").click(function () {
                    $("#btn").unbind("click", myFun2);
                    alert("aaa");
                })
            })
        </script>
        <button id="btn">删除第二个</button>
        <div id="test"></div>
    </body>
    </html>

  • 相关阅读:
    html大文件传输技术
    html大文件传输实例解析
    html大文件传输示例
    ckeditor粘贴word图片自动上传功能
    ckeditor不能粘贴word的问题
    ckeditor不能粘贴word的问题如何解决
    vue-ckeditor-word粘贴
    vue中使用ckeditor,支持wps,word,网页粘贴
    富文本编辑器复制word
    富文本编辑器粘贴word
  • 原文地址:https://www.cnblogs.com/chrisghb8812/p/5623755.html
Copyright © 2011-2022 走看看