Newbie trying really hard to understand what she is doing wrong. Your help would be appreciated.

<?xml version = "1.0" encoding = "utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHMTL 1.0 Strict//EN"

   "http://www.w3.org/TR/xhtml1/DTD/xhmt1-strict.dtd">
<!-- Fig. 8.12: Product order.html -->
<!-- Product script. -->
<html xmlns = "http://www.w3.org/1999/xhtml">
   <head>
      <title>Product Orders</title>
      <script type = "text/javascript">
         <!--
// Switch statement & variables with their proper values, declare the product and total to var product;var price;var total = 0;switch(product)

Switch ( price )

{   

    case "1":price = 2.98;
    break;  
    case "2":price = 4.50;
    break;
    case "3":price = 9.98;
    break;
    case "4":price = 4.49; 
    break;      
    case "5":price = 6.87;  
    break;
        default:price = undefined;}
    document.write("Welcome, please enter a product number. Press '0' to terminate the buying sequence.");
    document.write("<br />");
    document.write("Enter the number (1 - 5) of the product you wish to order.");
    document.write("<br />"); // Until the user enters "end" keep asking what product they wishwhile(product != 0)
{       product = prompt("Please enter which product you wish: ");  
    total = total + price;} document.write("The total cost is: $" + total);

// Switch statement & variables with their proper values, declare the product and total to 
    var product;
    var price;
    var total = 0;

switch(product)

{
    case 1:
        product 1 = 2.98;
        break;    
    case 2:
        product 2 = 4.50;
        break;
    case 3:
    product 3 = 9.98;
        break;  
    case 4:
        product 4 = 4.49;
        break;  
    case 5:
        product 5 = 6.87;
        break;  
    default:
        price = undefined;
}

document.write("Welcome, please enter a product number. Press '0' to terminate the buying sequence.");
document.write("<br />");
document.write("Enter the number (1 - 5) of the product you would like.");
document.write("<br />");

// Until the user enters "end" keep asking what product they want
while(product != 0)
{
    product = prompt("Please enter which product you wish: ");
    total = total + price;
}

document.write("The total cost is: $" + total); 
</script>

</head>
<body>

Didn't you start an identical thread? Double threading will not get you anywhere

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.