I have a variable that generates any number from 0 - 20. When i do document.write("variable") it just deletes everything on the page and shows the random number. How can i make the random number to show up without having the rest of the page deleted. Thanks for your help!
Don't use document.write() It caused the page to reload if used after the page has been rendered.
Create an element, for example:
and then write to the element with
document.getElementById('msg').innerHTML = "Your random number: '+Math.floor(Math.random()*20);
Note: Code is untested since you did not provide anything to test against.