How to display all prime numbers that exist in the given limits
<p>Create a HTML page which accepts user input into the text field as integer between 10 and
120. When the user pressed the “Display” button, your function created in JavaScript should
able to display all prime integer between 1 and 120.</p>

<p><strong>Example</strong> </p>

<p>Input Integer:
20</p>

<p>The Function should return:
<code>1, 2, 3, 5, 7, 11, 13, 17, 19</code></p>

<pre><code>function primeNumbers(){
var p;
var n = document.primeForm.primeText.value;
var d;
var x;
var prime;
var displayAll = 2 + " ";
for(p = 3; p &lt;= n; p = p+2){
    x = Math.sqrt(p);
    prime=1;
    for(d = 3; prime &amp;&amp; (d &lt;= x); d = d+2)
    if((p%d) == 0)
        prime = 0;
    else
        prime = 1;
    if(prime == 1){ 
        displayAll = displayAll + p + " ";
    }
}
document.primeForm.primeArea.value = displayAll;
</code></pre>

<p>}​</p>

<p>but it can display more than 120 :(</p>
