This is a killer:
You CAN NOT use document.write once a page is loaded. Doing so WIPES OUT the page, including even the JS code that did the document.write.
As your code stands, once you hit that button, your page is GONE!
There are lots of other things wrong in that code.
You code to get a random number is all wrong. *NEVER* use Math.round() when getting a random integer.
The correct code is:
So for dice you would use
var random = Math.floor( Math.random() * numberOfChoices );
That will get you *GOOD* random numbers from 0 to 5. Just add 1 to get numbers from 1 to 6.
var randomdice = Math.floor( Math.random() * 6 );
Your HTML is totally illegal. ALL this code
needs to be BETWEEN <body> and </body>. Oh, and you are missing the </form> tag.
<img src="d1.gif" name="mydice">
<input type="button" value="Throw dice!" onClick="throwdice()">
<input type="button" value="TIRA MONEDA!" onClick="sayHello()">
Use of document.images[ ] is obsolescent. Just give your images an id and then use document.getElementById().
*NEVER* use eval(). Expecially when there is NO NEED WHATSOEVER, as in this case.