I want an array of objects to monitor (loading of) each span element (using XMLHTTPRequest to retrieve a URL on another page and place into the relevant span - I haven't included this functionality below as I'm only interested in the object array).
I liked the idea of the following (Doug Crockford?) snippet, but I just can't get it to work. I get:
URLLoad.LoadingTxt000003.SetLoadTimeout is not a function
Any ideas?
Here's my code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script language="javascript" type="text/javascript">
function URLLoad(id) {
alert(id);
return URLLoad[id] = {
Tagid:id,
LoadTimeout:0
}
}
URLLoad.prototype.SetLoadTimeout = function(lt) {
this.LoadTimeout = lt;
}
URLLoad("LoadingTxt000003");
URLLoad("LoadingTxt000005");
alert(URLLoad.LoadingTxt000003.DelayTimeout + URLLoad.LoadingTxt000005.DelayTimeout);
URLLoad['LoadingTxt000003'].SetLoadTimeout(20); //doesn't work
URLLoad.LoadingTxt000003.SetLoadTimeout(20); //doesn't work
</script>
</head>
<body>
<span id="LoadingTxt000003">...</span>
<span id="LoadingTxt000005">...</span>
</body>
</html>