Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 8th, 2005, 12:47 PM   #1
big_k105
PFO Founder

 
big_k105's Avatar
 
Join Date: Mar 2004
Location: Fargo, ND
Posts: 1,649
Rep Power: 10 big_k105 is on a distinguished road
Send a message via AIM to big_k105 Send a message via MSN to big_k105 Send a message via Yahoo to big_k105
script wont run

Well for some reason it was running earlier but now it wont do anything but go straight to the html stuff and it skips the javascript can someone tell me what is goin on here thanks
<?xml version = "1.0"?>
   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
   
   <!-- Assignment9.html -->
   <!-- Assignment 9 -->
   
   <html xmlns = "http://www.w3.org/1999/xhtml">
   <head>
   	<title>An Addition Program</title>
   	<script type="text/javascript">
   	<!--
   	//Declare Varables
   	var productNum, amountSoldOne, amountSoldTwo, amountSoldThree, amountSoldFour, amountSoldFive,
   		totalOne, totalTwo, totalThree, totalFour, totalFive,
   		retailOne = 2.98,
   		retailTwo = 4.50,
   		retailThree = 9.98,
   		retailFour = 4.49,
   		retailFive = 6.87,
   		validInput = true;
   
   	//Main For Loop
   	for(var i=1; i<=5; i++)
   	{
   		productNum = window.prompt("Enter Product Number", i);
   		switch (productNum)
   		{
   			case "1":
 		 	amountSoldOne = window.prompt("Enter Number Sold for Product" + productNum, 0);
 				totalOne = amountSoldOne * retailOne;
   				break;
   			case "2":
 		 	amountSoldOne = window.prompt("Enter Number Sold for Product" + productNum, 0);
 				totalTwo = amountSoldTwo * retailTwo;
   				break;
   			case "3":
 		 	amountSoldOne = window.prompt("Enter Number Sold for Product" + productNum, 0);
 				totalThree = amountSoldThree * retailThree;
   				break;
   			case "4":
 		 	amountSoldOne = window.prompt("Enter Number Sold for Product" + productNum, 0);
 				totalFour = amountSoldFour * retailFour;
   				break;
   			case "5":
 		 	amountSoldOne = window.prompt("Enter Number Sold for Product" + productNum, 0);
 				totalFive = amountSoldFive * retailFive;
   				break;
   			default:
   				validInput = false;
   		}
   	}
   
   	if ( validInput == true )
   	{
   		document.writeln("<table>);
 		document.writeln( "<tr><td>" + i + "</td><td>" + amountSoldOne + "</td><td>" + totalOne + "</td></tr>);
 		document.writeln( "<tr><td>" + i + "</td><td>" + amountSoldTwo + "</td><td>" + totalTwo + "</td></tr>);
 		document.writeln( "<tr><td>" + i + "</td><td>" + amountSoldThree + "</td><td>" + totalThree +"</td></tr>);
 		document.writeln( "<tr><td>" + i + "</td><td>" + amountSoldFour + "</td><td>" + totalFour + "</td></t>);
 		document.writeln( "<tr><td>" + i + "</td><td>" + amountSoldFive + "</td><td>" + totalFive + "</td></tr>);
   		document.writeln("</table>");
   	} else {
   		document.writeln( "Invalid choice: " + choice );
   	}
   	-->
   	</script>
   </head>
   <body>
   	<p>Click Refresh (or Reload) to run the script again</p>
   </body>
   </html>

Thanks

edit: i have figured out that it is in my if statement somewhere as i comment those out and it runs fine thanks
__________________
BIG K aka Kyle
Programming Forums
Kyle K Online

Please do not PM or email me programming questions. Post them in the forums instead.

Last edited by big_k105; Apr 8th, 2005 at 12:57 PM.
big_k105 is offline   Reply With Quote
Old Apr 8th, 2005, 12:59 PM   #2
big_k105
PFO Founder

 
big_k105's Avatar
 
Join Date: Mar 2004
Location: Fargo, ND
Posts: 1,649
Rep Power: 10 big_k105 is on a distinguished road
Send a message via AIM to big_k105 Send a message via MSN to big_k105 Send a message via Yahoo to big_k105
figured it out i was missing a few " thanks for looking anyway
__________________
BIG K aka Kyle
Programming Forums
Kyle K Online

Please do not PM or email me programming questions. Post them in the forums instead.
big_k105 is offline   Reply With Quote
Old Apr 8th, 2005, 1:47 PM   #3
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
glad ya got it working big_k ... at least it wasn't a ;
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:23 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC