Forum Moderators: open
The following returns undefined:
searchQueue = new queueClass();
alert(searchQueue.getLength);
function queueClass () {
this.queue = new Array();
// alert(queue.length); this returns 0
}
queueClass.prototype.getLength=function() { return queue.length; }
===============================================
Another thing I've tried:
searchQueue = new queueClass();
alert(searchQueue.getLength());
function queueClass () {
this.queue = new Array();
}
function getLength(){
with(this) {return queue.length;}
}
queueClass.prototype.getLength = getLength;
This returns an error saying getLength() is not a function. If I remove the () on the second line then I get the 'undefined' again, instead of the '0'.
Any help is greatly appreciated.
searchQueue = new queueClass(); etc..
is nested in a pageLoad() function.
the pageLoad function is called using a more elaborate version of:
window.onload = pageLoad();
And the window.onload function is at the top of the external script, following pageLoad().
Does that help at all?