JQuery事件

原创 2018-11-20 18:43:35 197
摘要:<!DOCTYPE html> <html> <head>     <meta charset="UTF-8" />     <title>JQuery事件</title>   
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <title>JQuery事件</title>
    <script type="text/javascript" src="jquery-3.3.1.min.js"></script>
    <style type="text/css">
        .box{font-size:20px;color:pink;}
    </style>
</head>
<body>
<script type="text/javascript">
    //mousemove事件
    $(document).ready(function() {
        $(document).mousemove(function(xy){
            $('span').text('x: '+ xy.pageX + ' , ' +' y: '+ xy.pageY);
        })//mousemove事件
        number=0
        $(window).resize(function(){
            $('b').text(number+=1)
        })//resize事件
        $(document).mouseover(function(ab) {
            //$('label').addClass('box')
            $('input').css('background','blue')
        });
        $('button').click(function(){//click事件
            $('p').hide();
        })
        $('.btn').dblclick(function(){//双击事件
            $('p').show();
        })
    });

</script>
<div>当前的鼠标的位置:<span> </span></div>
<div>当前窗口变化次数:<b> </b></div>
<div>当前鼠标覆盖时:<label>鼠标指针</label><input type="text"  name="" value="" > </div>
<p>我是标签内容</p><button>单击隐藏</button> <button class='btn'>双击显示</button>
</body>
</html>

事件还是很多的,有时不知道用哪种更加适合。

发布手记

热门词条