Sorry, I don't understand. document.write() will over-write the whole content of the page, including the JavaScript which called it.
If you mean a prompt dialogue then the answer must be 1 - clicking on OK terminates the dialogue and runs whatever code follows.
Or do you mean something like this? That is, count the number of invalid entries?
Code:
<script type = "text/javascript">
var count = 0;
for (var i=1; i<2; i++) {
var ans = parseFloat(prompt ("Enter a number", ""));
count ++;
if ((isNaN(ans)) || (ans == "")) {
alert ("You must enter a number!! ");
i -- ;
}
}
alert ("You had " + count + " tries")
</script>
All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.