give this a try
<html><head> <title>...</title></head><body><script type="text/javascript"> var A = parseFloat(prompt("Number:")); var B = parseInt(1); while (B<Math.pow(A,.5)) { if (A%B == 0){document.write("nothing left.")} if (B<Math.pow(A,.5)) document.write(A+" is a prime number.") else document.write(A+" is not a prime number.") B++ }</script></body></html>