title: JavaScript id output only displays for a second then dissapears
body: <p>I am making a simple JavaScript function where you enter two numbers in a form and then the function determines if the sum of the two numbers is a prime. It all works but when the function displays a message with the document.getElementById("demo").innerHTML and </p> it is only on the web page for one second then disappears. I want to make it so the message stays until you click on the button again. I have searched this site and other site but have not been able to find anything. </p>
  
  <p>Here is the code:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;link href="/prime.css" rel="stylesheet" type="text/css" /&gt;
  &lt;script&gt;
  function prime()
   {
    // get the values from the form
   var x= document.forms["frm1"]["x"].value; 
   var y= document.forms["frm1"]["y"].value;
    //test the values of the form
   if (x == "null"|| x=="" || isNaN(x)|| y=="null" || y==""|| isNaN(y)){
   alert("You must enter two numbers.");
   exit;
   }
    //change variables to number and add them together
    var number = (parseInt(x)+ parseInt(y));
     var a="";
   var prime = true;
  
    //check to make sure number is not less than one
   if (number &lt;= 1){
   alert("Sorry " +number+ " is not a prime.");
   prime = false;
   exit;
   }
     //check if number is a prime
  for (var dividby = 2; dividby &lt;= number / 2; dividby++){
  if(number % dividby == 0)
      prime = false;
  break;
  
  }
      //send congratulations
  if(prime==true){
  
  a="congratulations " + number + " is a prime!";
  }
     //send condolences
  else{
  a="Sorry "+number+ " is not a prime.";
  }
  document.getElementById("demo").innerHTML=a;
  
  }
  
  &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body id="elem"&gt;
  &lt;div class="div"&gt;&lt;/div&gt;
  &lt;div&gt; 
      &lt;br&gt;
  &lt;h1&gt;PRIME NUMBERS&lt;/h1&gt;
  &lt;p&gt;Please enter two numbers to be added and see if the result is a prime.&lt;/p&gt;&lt;br&gt;
  &lt;form name="frm1" &gt;
  &lt;input type="text" name="x"&gt; 
  + &lt;input type="text" name="y"&gt;
  &lt;button onclick="prime()"&gt;click me&lt;/button&gt;
  &lt;/form&gt;
  &lt;br&gt;
  &lt;p id="demo"&gt;&lt;/p&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>