javascript| function//*******************************************************
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
for (i = 0; i < thearray.length; 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--; <<== I added the sentence, it's critical, otherwise it's wrong.
return retval;
}
// *******************************************************
Also give a few foreigners on the internet wrote
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 < Arguments.length; a_p++) {
This[this.length] = arguments[a_p]
}
Return this.length
}
if (typeof Array.prototype.push = = "undefined") {
Array.prototype.push = Array_push
}