Hi
I have the following code, if you just run it on a browser (IE6 to be precise) it is self explicative of the problem:
//---------------------------
var out=new Array(0)
var count=0;
for(var i in window){
++count;
out[++out.length-1]=window[i]
if(!confirm("property " + count + " value (out of 37 properties) is = " + window[i] + "\n\nIf you press cancel, last alert would yield all these values in a string, if you let the loop go to the end pressing only OK and NEVER cancel, the last alert shows... nothing!!\n\nIf you replace windows[i] in the codes just with I, the last alert shows the summary.")){break}
}
alert("summary of values should be = "+out)
//---------------------------
Any idea why it happens? I'm fighting with browser object properties. They even have alias: have you ever tried this:
alert(top.top.top.top.top.top.top.self.self.self.top.self.window.top.self.frames.frames.frames.locat ion)
well, it gives the location of the document: it means that top carries as a property of its own a property whose name is top: in this way instead of generating the error, produces a result: the dire consequence is that you cannot safely make a recursive function on browser properties! Also, some properties have aliases: somebody thoguht it was a cool idea to arrange browsers properties this way uh!
:-(
Anyway, if you've ideas on the code above...
I have the following code, if you just run it on a browser (IE6 to be precise) it is self explicative of the problem:
//---------------------------
var out=new Array(0)
var count=0;
for(var i in window){
++count;
out[++out.length-1]=window[i]
if(!confirm("property " + count + " value (out of 37 properties) is = " + window[i] + "\n\nIf you press cancel, last alert would yield all these values in a string, if you let the loop go to the end pressing only OK and NEVER cancel, the last alert shows... nothing!!\n\nIf you replace windows[i] in the codes just with I, the last alert shows the summary.")){break}
}
alert("summary of values should be = "+out)
//---------------------------
Any idea why it happens? I'm fighting with browser object properties. They even have alias: have you ever tried this:
alert(top.top.top.top.top.top.top.self.self.self.top.self.window.top.self.frames.frames.frames.locat ion)
well, it gives the location of the document: it means that top carries as a property of its own a property whose name is top: in this way instead of generating the error, produces a result: the dire consequence is that you cannot safely make a recursive function on browser properties! Also, some properties have aliases: somebody thoguht it was a cool idea to arrange browsers properties this way uh!
:-(
Anyway, if you've ideas on the code above...
Comment