Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Feb 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Expected "}" Help?!

    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--

    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>
    Thanks
    Rob

  • #2
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Because you open a brace pair at line 53, and don't close it. You then open another one that you don't close at line 57.
    Code:
    53			function displayObjectProperties(o) {
    /.../
    57				for(var p in eval(o)) {
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •