This is a killer:
Code:
else{return document.write('AGUILA!')}
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:
Code:
var random = Math.floor( Math.random() * numberOfChoices );
So for dice you would use
Code:
var randomdice = Math.floor( Math.random() * 6 );
That will get you *GOOD* random numbers from 0 to 5. Just add 1 to get numbers from 1 to 6.
Your HTML is totally illegal. ALL this code
Code:
<img src="d1.gif" name="mydice">
<form>
<input type="button" value="Throw dice!" onClick="throwdice()">
<p>
<input type="button" value="TIRA MONEDA!" onClick="sayHello()">
<div id="result"></div>
needs to be BETWEEN <body> and </body>. Oh, and you are missing the </form> tag.
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.