zoukankan      html  css  js  c++  java
  • JS 回车跳转

    window.onload = function () {
    SeteasyuiTheme();
    jQuery(':input:enabled').addClass('enterIndex');
    var textboxes = jQuery('.enterIndex');
    if ($.support.mozilla) {
    jQuery(textboxes).bind('keypress', CheckForEnter);
    } else {
    jQuery(textboxes).bind('keydown', CheckForEnter);
    }
    };

    function CheckForEnter(event) {

    if (event.keyCode == 13 && $(this).attr('type') != 'submit' && $(this).attr('type') != 'reset' && $(this).attr('type') != 'hidden') {
    var i = $('.enterIndex').index($(this));
    var n = $('.enterIndex').length;
    if (i < n - 1) {
    if ($(this).attr('type') != 'radio') {
    NextDOM($('.enterIndex'), i);
    }
    else {
    var last_radio = $('.enterIndex').index($('.enterIndex[type=radio][name=' + $(this).attr('name') + ']:last'));
    NextDOM($('.enterIndex'), last_radio);
    }
    }
    return false;
    }
    }

    function NextDOM(myjQueryObjects, counter) {
    if (myjQueryObjects.eq(counter + 1)[0].disabled) {
    NextDOM(myjQueryObjects, counter + 1);
    }
    else if (myjQueryObjects.eq(counter + 1).attr('type') == 'hidden') {
    NextDOM(myjQueryObjects, counter + 1);
    }
    else if (myjQueryObjects.eq(counter + 1).attr('readonly') == 'readonly') {
    NextDOM(myjQueryObjects, counter + 1);
    }
    else {

    if (myjQueryObjects.eq(counter + 1).attr('type') == 'button') {

    myjQueryObjects.eq(counter + 1).trigger('click');
    } else {

    myjQueryObjects.eq(counter + 1).focus();
    myjQueryObjects.eq(counter + 1).trigger('focus');
    myjQueryObjects.eq(counter + 1).trigger('select');
    }
    }
    }

  • 相关阅读:
    hdu1593(find a way to escape)
    每日学习小记 11/02
    将博客搬至CSDN
    浏览器渲染机制
    适配器模式 The Adapter Pattern
    工厂方法模式 The Factory Method Pattern
    观察者模式 The Observer Pattern
    模板方法模式 The Template Method Pattern
    命令模式 The Command Pattern
    迭代器模式 The Iterator Pattern
  • 原文地址:https://www.cnblogs.com/zhang9418hn/p/3670033.html
Copyright © 2011-2022 走看看