• (18)jq事件操作


    jq的私人网站:http://jquery.cuishifeng.cn/

    具体的查看上面的网站

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>jq事件操作</title>
    <style>
    .box,.box2 {
    200px;
    height: 200px;
    background-color: yellowgreen;
    }
    </style>
    </head>
    <body>
    <div class="box">box</div>
    <div class="box1">box1</div>
    <div class="box2">box2</div>
    <input class="inp" type="text">
    </body>
    <script src="js/jq.js"></script>
    <script>
    //jq的弹出窗口事件有两种写法
    //1、jq设置点击弹窗
    var $box = $('.box');
    $box.click(function () {
    alert('这是jq事件')
    });
    //2、这是第二种
    var $box1 = $('.box1');
    $box1.on('click',function () {
    alert('这是第二种事件写法')
    });

    //获取焦点
    $('.inp').focus(function () {
    console.log('获取焦点')
    });

    //失去焦点
    $('.inp').blur(function () {
    console.log('失去焦点')
    });

    //mouseover和mouseenter是一样的
    $('.box').mouseenter(function () {
    console.log('鼠标移入')
    });

    $('.box').mouseout(function () {
    console.log('鼠标移出')
    });

    $('.box').mousemove(function () {
    console.log('鼠标在区域内移动')
    });

    $('.box2').mouseenter(function () {
    console.log('鼠标移入')
    });

    $('.box2').mouseout(function () {
    console.log('鼠标移出')
    });

    $('.box2').mousemove(function () {
    console.log('鼠标在区域内移动')
    });

    //事件转换成on状态
    $('.box2').on('mouseover',function () {
    console.log('事件转成on状态')
    })

    </script>
    </html>
  • 相关阅读:
    FCN网络
    YOLO学习
    图像的几何变换-仿射变换和透射变换
    图像处理中的插值方法
    opencv中imgshow图像显示为灰色
    JDBC开发,数据库的连接
    Object类和String类
    动态线条,随鼠标移动吸附效果
    匿名对象,内部类,包,访问修饰符,代码块
    final关键字,static关键字
  • 原文地址:https://www.cnblogs.com/shizhengquan/p/10438362.html
Copyright © 2020-2023  润新知