zoukankan      html  css  js  c++  java
  • JQuery绑定事件

    <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=gbk" />
            <title>StripingTable</title>
            <script type="text/javascript" src="jquery-1.2.1.js"></script>
            <script type="text/javascript">
            <!--
                $(document).ready(function(){
                    //给id为p2的绑定事件
                    $("#p2").bind("click",function(){
                        alert($(this).text());
                    });
                    
                    //给id为p1的绑定事件,带参数,在内部绑定处理方法过程
                    $("#p1").bind("click",{t:new Date()},function(event){
                        alert($(this).text()+"  " + event.data.t);
                    });
                    
                    //给id为p3的绑定事件,带参数,在外部绑定处理方法交给了runClick函数
                    $("#p3").bind("click",{t:new Date()},runClick);
                    
                    //取消form的默认submit方法
                    $("form").bind("submit",function(){return false});
                });
                
                function runClick(event){
                    alert($(this).text()+"  " + event.data.t);
                }
            -->
            </script>
        </head>
        <body>
            <div class="title_a">一、事件处理</div>
            <div class="title_b">(一)、bind(type,data,fn)用法!</div>
            <div>不带参数</div>
            <p id="p2">点我试试</p>
            <div>带参数的</div>
            <p id="p1">a. 直接函数内绑定参数,点我再试试</p>
            <p id="p3">b. 间接函数内绑定参数,点我再试试</p>
            <div>利用绑定事件来取消掉submit的默认提交方式</div>
            <form action="http://www.wozaishuo.com.cn">
                <input type="submit" value="现在已经提交不了了"/>
            </form>
        </bdoy>
    </html>
  • 相关阅读:
    sql developer 中文乱码解决办法
    ubuntu oracle数据库18c安装
    ubuntu Oracle SQL Developer 安装
    web.xml is missing and <failOnMissingWebXml> is set to true
    MySQL设置快速删除
    Annoying “Remote System Explorer Operation” causing freeze for couple of seconds
    安装程序时出现2502 2503错误解决方法
    Smoke Testing(冒烟测试)
    MySQL5.7.11免安装版的安装和配置:解决MYSQL 服务无法启动问题
    Error 2503 and 2502 when installing/uninstalling on Windows 10
  • 原文地址:https://www.cnblogs.com/top5/p/1582118.html
Copyright © 2011-2022 走看看