EDIT noticed this issue after I posted other
var number = prompt("Plese enter your number:").value;
The .value thing is wrong.
You need to change it to :
var number = prompt("Plese enter your number:");
########################################
Where did you define the JS?
Does JS only run after onload() of page?
If it runs before the page is completely done loading then it will not find the elements (marked by your ids).
Also, if you are popping up a window and then running the code, the new window may not have the element ids it's looking for.
Most likely you are running hte code before onload. THis is a common mistake.
We'd have to see the main HTML page to know more about the problem.