1 Reply Latest reply on Feb 12, 2015 10:42 AM by Karl Heinz Kremer

    Javscript prompt() keeps appearing

    tannerdibella

      In my script below, the prompt () keeps appearing, even after a value has been entered:

       

      <html>

      <body>

      <script type="text/javascript">

      /*

      The Ounce to Pounds formula: 1 ounce = 0.0625 pounds

      */

      var i=0;

      while (i<=0)

      {

      var ounces = prompt("Enter number of Ounces" , "1");

      if (ounces==null) /* Test for cancel */

      {

      i="1";

      }

      else

      {

      var pounds= ounces * 0.0625; /* Compute number of pounds */

      document.write("<BR>","Ounces : ",ounces);

      document.write("<BR>","Pounds : ",pounds);

      document.write("<BR>");

      }

      }

      </script>

      </body>

      </html>