zoukankan      html  css  js  c++  java
  • jQuery学习三——事件

    代码如下:

    <!DOCTYPE html>
    <html>
    <head>
        <title>jquery事件</title>
    </head>
    <script type="text/javascript" src='./js/jquery-3.2.1.min.js'></script>
    <script type="text/javascript">
        $(document).ready(function(){
          // $("#p1").mouseenter(function(){
          //   alert('您的鼠标移到了 id="p1" 的元素上!');
          // });
    
          $("#p1").click(function() {
              alert('你点击了。。。');
          });
        });
    
    </script>
    <body>
    <p id="p1">试试能点击么?</p>
    </body>
    </html>

    $(document).ready()

    $(document).ready() 方法允许我们在文档完全加载完后执行函数。<必须写,不然不能实现>

    相关函数:

    click() 点击触发

    dblclick() 双击触发

    mouseenter() 鼠标穿过触发

    mouseleave() 鼠标离开触发

    mousedown() 鼠标移到元素,并且按下触发

    mouseup() 在元素上松开鼠标触发

    hover() 模拟光标悬停

    focus() 获得焦点触发

    blur() 失去焦点触发

  • 相关阅读:
    全排列(next_permutation)
    Codeforces Round #321 (Div. 2)C(tree dfs)
    cf_ducational Codeforces Round 16_D(gcd)
    cf455a(简单dp)
    cf584a(水题)
    cf112a(水题)
    冒泡排序
    Python内置类型性能分析
    常见时间复杂度
    MongoDB 备份
  • 原文地址:https://www.cnblogs.com/pengsi/p/7904248.html
Copyright © 2011-2022 走看看