Javascript loop, sum and output
<p>I'm trying to write a simple javascript, or so I think, using "while" loops, "prompts", and "alerts".
I want the user to have a prompt to ask how many items he bought
then I want to take the number he entered and return the same number of prompts for the prices, then I want to use a while loop to total those prices up and add 7% sales tax to the whole thing, and then print the total off in an alert window</p>

<p>So here’s what I have so far:</p>

<pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt; Meal Total &lt;/title&gt;
    &lt;script language="JavaScript"&gt;
        var result;
        meal=prompt("Number of Items: ");
     &lt;/script&gt; &lt;script language = "JavaScript"&gt;
var tip = 1.07; &lt;/script&gt;
&lt;/head&gt; &lt;body bgcolor = "white"&gt; &lt;center&gt; &lt;script language = "JavaScript"&gt;
if (meal&gt; 0) {
    var index = 0;
    while (index &lt; meal) {
        prompt("price of the item");
        index = meal;
    }
};
else if (meal == 0) {
    alert("Number is 0");
} else if (meal &lt;0) {
    alert("You entered is negative");
} &lt;/script&gt;&lt;/center&gt; &lt;/body&gt;&lt;/html&gt;
</code></pre>

<p>As you can see, I have most of the coding done. I have it detecting a negative or 0 for the number inputed. I need the followign things corrected: First, why does it ignore the number of prompts given for the imput value? When I open it and enter two, only 1 prompt window is shown. Second, how do I sum the prompt boxes?</p>
