Hey i was asked to write two programs. one that determines if an integer is a prime and another to state all the primes between two integers. I have written the first and it works perfectly fine (if not a little over complicated) but I'm having trouble with the second.
I worked out the basic algorithm for it but i cant for the life of me work out how to incorporate two window.promt() into the code without messing it up. there meant for a low and high number for the user to input before receiving all the primes in between those numbers. Here is the basic code.

<html>
<body>
<script language="javascript">

l=1000;n=3;p=1;
primes = new Array()
primes[0]=2;
while (n<=l){q=1;
while (primes[q]<=Math.floor(Math.sqrt(n)) && n/primes[q]!=Math.round(n/primes[q])){q++;}
if ((n-1)/1000==Math.round((n-1)/1000)){window.status="Numbers checked so far: "+(n-1);}
if (n/primes[q]!=Math.round(n/primes[q])){primes[p]=n;p++;}
n+=2;}
document.write ("What follows next are prime numbers:<br>"+primes.join(", "));
</script>
</body>
</html>

I apologise for how messy it is. help would be appreciated I wont have any hair left to pull out soon