I'm new to html and javascript. How can I display the for loop that I have in my javascript function on the same page upon clicking the button. Right now I click the button and it brings me to a whole different page displaying 0 to -99. I want the numbers to appear below the button on the same page. Any ideas?
<fieldset>
<legend>Loop Until -99</legend>
<form name="loopuntil99" method="post">
<input type="button" value="Display -99" onclick="displayArray()" />
</form>
</fieldset>
</body>
<script type="text/javascript">
function displayArray()
{
for (i=0;i>-100;i--)
{
document.write(i + ", ");
}
}
</script>
</html>