Jump to content

Removing Javascript Box

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
kentona

kentona

    Newbie

  • Members
  • PipPip
  • 19 posts
I am making a number javascript program and i need to know how do i go about removing the dialogue box in javascript so it displays the numbers on the browser and not this,

Posted Image


<!-- Odd -->

<html>

  <head>

    <title>Odd</title>

      <style type="text/css">

        body {

              background-color:#000000;

              color:#FFFFFF;

              font-size:30;

              text-align:center;

             }

      </style>

  </head>

  <body>

    <script type="text/javascript">

      var limit, count, stroutput;

      count = 1;

      stroutput = "";

      document.write("<h1>Odd Numbers</h1>");

      limit = prompt("Enter the limit", "");

      if (limit == null)

      {

       stroutput = ("You clicked cancel. No count will be shown.");

      }

      else if (limit == "")

      {

       stroutput = ("Limit must be entered.");

      }

      else if (limit != parseInt(limit))

      {

       stroutput = ("Limit must be a valid whole number");

      }

      else

      {

      while (count <= limit) {

        stroutput = stroutput + count + "\n";

        count = count + 2;

      }

      }

      alert (stroutput);

      document.write("<br /><br />");

      document.write("<br /><br />");

      document.write("<input type='button' name='cmdReload'");

      document.write(" value='Do again' onclick='window.location.reload()' />");

    </script>


  </body>

</html>


Many thanks this problem has been driving me crazy.

#2
Guest_johnny.dacu_*

Guest_johnny.dacu_*
  • Guests
replace the line:
alert(stroutput);
with
document.write(stroutput);

This shoud be enough.