Copy codeThe Code is as follows: var paramBeanList = new Array ();
Array. prototype. addParamBean = function (paramBeanObj ){
Var index = this. containParamBean (paramBeanObj );
If (index! =-1 ){
This [index] = paramBeanObj;
} Else {
This. push (paramBeanObj );
}
};
Array. prototype. clear = function (){
If (this. length = 0 ){
Return;
}
For (var index in this ){
This. pop ();
}
};
Array. prototype. containParamBean = function (paramBeanObj ){
Var index =-1;
If (this. length = 0 ){
Return index;
}
For (var tempIndex = 0, step = this. length; tempIndex <step; tempIndex ++ ){
If (this [tempIndex]. compare (paramBeanObj) = 0 ){
Index = tempIndex;
Break;
}
}
Return index;
};
Var ParamBean = new function (pkCode, opDate, value ){
This. pkCode = pkCode;
This. opDate = opDate;
This. value = value;
};
ParamBean. prototype = {
ToString: function (){
Return "[pkCode:" + this. pkCode + ", opDate:" + this. opDate + ", value:" + this. value + "]";
},
DoVerify: function (){
Return (this. pkCode? This. opDate? This. value? "True": "false ");
},
Compare: function (otherObj ){
Var result =-1;
If (otherObj ){
If (this. pkCode = otherObj. pkCode & this. opDate = otherObj. opDate
& This. value = otherObj. value ){
Result = 0;
}
}
Return result;
}
};
Var ParamUtils = new Object ();
ParamUtils. doCreateAjaxStr = function (){
Var paramStr = "";
If (paramBeanList. length = 0 ){
Return paramStr;
}
Var keyParamArray = new Array ();
Var valueParamArray = new Array ();
For (var index = 0, step = paramBeanList. length; index <step; index ++ ){
Var tempObj = paramBeanList [index];
KeyParamArray. push (tempObj. pkCode + "'" + tempObj. opDate );
ValueParamArray. push (tempObj. value );
}
ParamStr = "KEY_PARAM = ". concat (encodeURIComponent (keyParamArray. join (","))). concat ("&"). concat ("VALUE_PARAM = ". concat (encodeURIComponent (valueParamArray. join (","))));
Return paramStr;
};
After writing this article for a while, I couldn't mention it for a long time on csdn. I switched to advanced editing using IE6, and the content was blank. Finally, I used the Firefox browser to bring it up again ..