Hi, I am new to javascript. I wrote the following function rollDice() to produce 5 random numbers and display them. I use an anchor with click event to call the function. Problem is, in Chrome it won't display, works fine in IE, in firefox the 5 values display and then the original page w/anchor appears! I am suspicious that my script tag is too general but I am really lost. Also if there is a display function that doesn't clear the screen first that would be great.
diceArray = new Array(5)
function rollDice() { var i;
for(i=0; i<5; i++) { diceArray[i]=Math.round(Math.random() * 6) % 6 + 1;
document.write(diceArray[i]); } }
when I click should display 5 rand variables