js代码这样写,是什么意思?作用是什么?我以前没用过,请大侠解释一下,它与function disable(){}有区别吗?区别在那里?disable: function(){
if(this[0] && this.type!="select-one"){
for(var i=0;i<this.length;i++){
this[i].disabled= true;
}
}else{
this.disabled= true;
}
}

解决方案 »

  1.   

    json结构的写法
    var person={
      sex:0,
      pk:function(s){
        alert(s);
      }
    }
    //调用
    alert(person.sex)
    person.PK("123")
      

  2.   

    还有这样的代码经常这样写:
    var bb={
    disable: function(){ 
    if(this[0] && this.type!="select-one"){ 
    for(var i=0;i <this.length;i++){ 
    this[i].disabled= true; 

    }else{ 
    this.disabled= true; 

    }, 
    able: function(){ 
    if(this[0] && this.type!="select-one"){ 
    for(var i=0;i <this.length;i++){ 
    this[i].disabled= true; 

    }else{ 
    this.disabled= true; 

    }}
    是什么意思?是定义一个数组吗?
      

  3.   

    是一个object 就像java的一个class
      

  4.   

    function doSubmit(){
    $("select option").attr("selected", true);
    var ops = {
    beforeSubmit: function(formArray, jqForm) {
    if($("option[selected]",$("#to")).size()==0){
            alert(send_to);
            return false;
            }else{
             $("#mailing").html("Sending...");
            }
        },

        success: function(responseText) {
         $("#mailing").html("");
            alert(responseText);
        }
    };
    $("#oform").ajaxSubmit(ops);
    }楼上,我还想问一下,像这个发信的js中的beforeSubmit与success属性,我在那里可找到引用它们的地方?ops对象放到了ajaxSubmit方法中充当参数,是不是在ajax的这个方法中封装了调用这两个属性的方法?
      

  5.   

    知道了,是jquery.form.js中封装的,还是谢谢你了.