Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-24-2004, 06:43 AM   PM User | #1
BlueOysterCult
New to the CF scene

 
Join Date: Feb 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
BlueOysterCult is an unknown quantity at this point
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
BlueOysterCult is offline   Reply With Quote
Old 02-24-2004, 07:59 AM   PM User | #2
liorean
The thread killer


 
Join Date: Feb 2003
Location: Umeå, Sweden
Posts: 5,575
Thanks: 0
Thanked 84 Times in 75 Posts
liorean will become famous soon enoughliorean will become famous soon enough
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
liorean is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:52 PM.


Advertisement
Log in to turn off these ads.