NomenNescio Posted April 23, 2007 Share Posted April 23, 2007 <html><head><script type="text/javascript">function disp_prompt(){times=prompt("How many numbers?","0")var numbers = "";while(times > 0){var x = Math.round(9*Math.random());numbers = numbers + x;times--;}document.write(numbers); }</script></head><body><input type="button" onclick="disp_prompt()" value="Display a prompt box" /></body></html> I created this code, After I enter the amount of numbers I want to be generated it gets stuck.I'm wondering why. Thank you for your time. Link to comment Share on other sites More sharing options...
zppblood Posted April 23, 2007 Share Posted April 23, 2007 <html><head><script type="text/javascript">function disp_prompt(){times=prompt("How many numbers?","0")var numbers = "";while(times > 0){var x = Math.round(9*Math.random());numbers = numbers + x;times--;}document.getElementById("random").innerHTML=numbers; }</script></head><body><input type="button" onclick="disp_prompt()" value="Display a prompt box" /><p id="random"></p></body></html> Link to comment Share on other sites More sharing options...
NomenNescio Posted April 23, 2007 Author Share Posted April 23, 2007 Thanks, I needed this =) Link to comment Share on other sites More sharing options...
zppblood Posted April 23, 2007 Share Posted April 23, 2007 Learn getElementById and getElementsByTagName; they are very helpful in Javascript. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now