1 <HTML> 2 <HEAD> 3 <TITLE>JavaScript Example: Property lists</TITLE> 4 </HEAD> 5 <BODY BGCOLOR="#FFFFFF"> 6 7 <SCRIPT LANGUAGE="JavaScript"> 8 9 var n = 4; 10 var objectStr = new Array(n); 11 objectStr[0] = "navigator"; 12 objectStr[1] = "window"; 13 objectStr[2] = "window.history"; 14 objectStr[3] = "window.document"; 15 16 var object; 17 for ( var i = 0; i < n; i++ ) { 18 object = eval(objectStr[i]); 19 document.writeln("<B>" + objectStr[i] + ":</B><BR>"); 20 for ( prop in object ) { 21 document.write(prop + " = "); 22 with ( object ) { 23 document.write(eval(prop)); 24 } 25 document.writeln("<BR>"); 26 } 27 document.writeln("<P>"); 28 } 29 30 // A kludge: 31 document.writeln("<B>window.location:</B><BR>"); 32 for ( var prop in location ) { 33 with ( location ) { 34 document.write(prop + " = "); 35 document.writeln(eval(prop), "<BR>"); 36 } 37 } 38 39 </SCRIPT> 40 41 </BODY> 42 </HTML>