//************************************** *****************
// Replacements for unsupported array functions (because arrayname. push (var)
// And arrayname. pop () are not implemented in IE until version 5.5)
Function thearrayisgood (thearray, I ){
If (thearray [I] = "undefined") | (thearray [I] = "") | (thearray [I] = null ))
Return false;
Else
Return true;
}
Function getarraysize (thearray ){
// Replacement for arrayname. length property
For (I = 0; I if (thearray [I] = "undefined") | (thearray [I] = "") | (thearray [I] = null ))
Return I;
}
Return thearray. length;
}
Function arraypush (thearray, value ){
// Replacement for arrayname. push (value)
Thearraysize = getarraysize (thearray );
Thearray [thearraysize] = value;
Return thearray [thearraysize];
}
Function arraypop (thearray ){
// Replacement for arrayname. pop ()
Thearraysize = getarraysize (thearray );
Retval = thearray [thearraysize-1];
Delete thearray [thearraysize-1];
Thearray. length --; return retval;
}
//************************************** *****************
In addition, I will provide some information written by foreigners on the Internet.
Function Array_pop (){
Var response = this [this. length-1]
This. length --
Return response
}
If (typeof (Array. prototype. pop) = "undefined "){
Array. prototype. pop = Array_pop
}
Function Array_push (){
Var A_p = 0
For (A_p = 0; A_p this [this. length] = arguments [A_p]
}
Return this. length
}
If (typeof Array. prototype. push = "undefined "){
Array. prototype. push = Array_push
}
Trackback: http://tb.blog.csdn.net/TrackBack.aspx? PostId = 558849