zoukankan      html  css  js  c++  java
  • Jquery tabs

    官网
    http://api.jqueryui.com/tabs/


    必须通过了后台验证tab1的信息后才允许进入tab2

            var passed=false;
             $("#tabs").tabs({
                event: "click",
                active: 0,
                beforeActivate: function (event, ui) {
                    if (ui.newTab.text() == "Tab2") {
                      $('#tabs-1 .validationMsg').hide();
                        var ok = true;
                        if (!passed ) {
                            ok = validate();  //前台validation
                        }

                        var toDo = function () {
                            passed = true;
                            $('#tabs').tabs("option", "active", 1);
                            //$('#tabs ul li:eq(1) a').focus();
                        }

                        var notToDo = function () {
                            passed = false;
                            var errorMsg = $('#tabs-1 .validationMsg').html();
                            // event.preventDefault();
                            // ui.oldTab.focus();
                            $('#tabs').tabs("option", "active", 0);
                            $('#tabs ul li:eq(0) a').focus();
                            setTimeout("$('#tabs-1 .validationMsg').html('" + errorMsg + "');$('#tabs-1 .validationMsg').show();", 0);
                            return;
                        }

                        if (!ok) {
                            event.preventDefault();
                            notToDo();
                        }
                        else {
                            if (!passed) {
                                validate2($('#tabs-1'), '/controller/action', toDo, notToDo);  //后台ajax验证
                                event.preventDefault();
                            }
                        }

                    }
                }
            });


     

  • 相关阅读:
    题解45 跳跃游戏 II
    《重构》第八章阅读总结
    Scala学习笔记一
    Java初学随笔
    染色算法总结
    BingMap
    Google Earth API 替换方案
    本周安排
    OleDb 内存泄露问题
    css3 布局
  • 原文地址:https://www.cnblogs.com/sui84/p/6777183.html
Copyright © 2011-2022 走看看