jq中的事件

160 阅读1分钟

键盘事件:

用户名: 密码: ('input[type=password]').keyup(function(){ // alert('鼠标抬起了') // }) / 产生可打印的字符时 连续敲击键盘的时候触发 / // (input[type=password]).keypress(function()//alert(连续敲击键)//)('input[type=password]').keypress(function(){ // alert('连续敲击键盘') // }) (document).keyup(function(e){ / 敲击回车的时候触发 */ if(e.keyCode==13){ alert('我提交了') } })

鼠标移入移出

        /* hover 由mouseenter和mouseleave组成 */
    // $('.div1').hover(function(){
    //     console.log(1);
    // })

    /*  mouseenter mouseleave ★在进入子元素区域的时候不会触发*/
    // $('.div1').mouseenter(function(){
    //     console.log('mouseenter');
    // })
    // $('.div1').mouseleave(function(){
    //     console.log('mouseleave');
    // })

    /*  mouseover和 mouseout 在进入子元素区域的时候也会触发*/
    // $('.div1').mouseover(function(){
    //    console.log('mouseover')
    // })
    // $('.div1').mouseout(function(){
    //     console.log('mouseout')
    // })