![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
PFO Founder
![]() ![]() |
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. |
|
|
|
|
|
#2 |
|
PFO Founder
![]() ![]() |
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. |
|
|
|
|
|
#3 |
|
Programming Guru
![]() ![]() ![]() |
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." |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|