Javascript 使用JQuery的IE中的堆栈溢出(第12/1076行)

Javascript 使用JQuery的IE中的堆栈溢出(第12/1076行),javascript,jquery,stack-overflow,Javascript,Jquery,Stack Overflow,我使用的是来自GoogleCDN的JQuery,在第12行(对于min文件)和第1076行(对于未压缩的文件),我得到了堆栈溢出错误(使用IE8)。堆栈溢出错误所在行的JQuery代码是: JQuery.js 这是我的密码: $(文档).ready(函数(){ $(“#newcmpgn”).validate({ errorElement:'dt', 规则:{同意:“必需”}, 消息:{同意:“您需要接受条款和条件才能继续。”} }); $(“#newcmpgn”).submit(函数(){

我使用的是来自GoogleCDN的JQuery,在第12行(对于min文件)和第1076行(对于未压缩的文件),我得到了堆栈溢出错误(使用IE8)。堆栈溢出错误所在行的JQuery代码是:

JQuery.js

这是我的密码:

$(文档).ready(函数(){
$(“#newcmpgn”).validate({
errorElement:'dt',
规则:{同意:“必需”},
消息:{同意:“您需要接受条款和条件才能继续。”}
});
$(“#newcmpgn”).submit(函数(){
if($(“#newcmpgn”).valid(){
var ubal=Number($(“#userbalance”).val();
var camt=数字($(“#金额”).val();
如果(ubal>camt){
$(“#newcmpgn”).attr('action',”);
返回true;
}
if($(“#autorenew”).attr('value')=='Y'){
$(“#newcmpgn”).attr('action',”);
}否则{
$(“#newcmpgn”).attr('action',”);
}
$(“#newcmpgn”).submit();
返回true;
}
返回false;
});
});
提交表单时出现错误。我在这里看不到任何递归代码会让IE8开始为堆栈耗尽而哭泣

谢谢, Dw.

您正在调用
$(“#newcmpgn”).submit()


在我看来那是递归的

我忘了提-它也撞毁了Safari 4!是的-没有错误,没有消息,Safari 4只是崩溃了!不过Firefox3.5上没有错误消息。是的,就是这样!愚蠢的我——完全忽略了这一点。本应做的只是“返回真实”。非常感谢您的指点。
makeArray: function( array ) {
    var ret = [];

    if( array != null ){
        var i = array.length;
        // The window, strings (and functions) also have 'length'
        // @ALL : this is the line i am getting error on ...
        if( i == null || typeof array === "string" || jQuery.isFunction(array) || array.setInterval )
            ret[0] = array;
        else
            while( i )
                ret[--i] = array[i];
    }

    return ret;
},
  $(document).ready(function(){
    $("#newcmpgn").validate({ 
      errorElement:'dt', 
      rules:{agree: "required"},
      messages:{agree: "You need to accept to Terms and Conditions in order to continue."}
    });
    $("#newcmpgn").submit(function(){
      if($("#newcmpgn").valid()){
        var ubal = Number($("#userbalance").val());
        var camt = Number($("#amount").val());
        if(ubal > camt){
          $("#newcmpgn").attr('action', '<?= site_url('account/payments/actpayment/'.$cmpgn_id) ?>');
          return true;
        }
        if($("#autorenew").attr('value') == 'Y'){
          $("#newcmpgn").attr('action', '<?= site_url('account/payments/makepayment/'.$cmpgn_id) ?>');
        }else{
          $("#newcmpgn").attr('action', '<?= site_url('account/payments/makesinglepayment/'.$cmpgn_id) ?>');
        }
        $("#newcmpgn").submit();
        return true;
      }
      return false;
    });
  });