Hello
my error says Expected curly bracket on line 70 ---
I CAN'T see why - I know it (the error) may actually lie somewhere else can someone help me? line 70 is right before the "</head> tag--
Thanks
Rob
my error says Expected curly bracket on line 70 ---
I CAN'T see why - I know it (the error) may actually lie somewhere else can someone help me? line 70 is right before the "</head> tag--
Code:
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title> Cis211 Assignment 8 - Object Browser </title> <script language="JavaScript"> function getArgs() { var args = new Object(); var data = location.search; var pairs = data.substring(1).split("&"); for(var i in pairs) { var del = pairs[i].indexOf("="); var name = pairs[i].substring(0, del); var value = pairs[i].substring(del+1); args[(name)] = value; } return args; } function displayObjectProperties(o) { var props = new Array(); var element = 0; /* Load the properties of the specified object into an array, * skipping the functions defined in this page. */ for(var p in eval(o)) { if(p != "displayObjectProperties" && p != "getArgs" && p != "myObject" && p != "args") { props[element++] = p; } } document.write("<h2>" + o + "</h2>"); document.write("<p id='parm_list'>"); props.sort(); for(var i=0; i<props.length; i++) { document.write(props[i] + "=" + eval(o)[props[i]] + "<br />"); } document.write("</p>"); } </script> <script language="JavaScript"> function displayObjectProperties(o) { var props = new Array(); var element = 0; for(var p in eval(o)) { if(p != "displayObjectProperties" && p != "getArgs" && p != "myObject" && p != "args") { props[element++] = p; } document.write("<h2>" + o + "</h2>"); document.write("<p id='parm_list'>"); props.sort(); for(var i=0; i<props.length; i++) { document.write("</p>"); } </script> </head> <body> <h1>Object Browser</h1> <form method="get" action="index.html"> Object: <input type="text" name="textbox" size="12"><br /> <input type="submit" name="submit" value="Submit" /> </form> <script> var args = getArgs(); var myObject = new String(); if (args.submit == "Submit") { /* if the user input from the text box is a valid * object in the browser window, use that, otherwise * display the selected value from the drop-down box. * If nothing was selected, display an error. */ if (args.textbox != "") { myObject = args.textbox; } else if (args.ObjectName != "nothing") { myObject = args.ObjectName; } else { document.write("<h2>Error!</h2><p>You must enter a valid "); document.write("window object or select an item from the "); document.write("drop down box.</p>"); } // display the specified object properties names and values displayObjectProperties(myObject); } </script> </body> </html>
Rob
Comment