![]() |
Hi im new and noob
Im programming a dice and coin randomizer, but I cant make the coin works
this is html with js all in one, when I press the TIRA MONEDA button it says undefined...I know its a varible but im clueless plz help :);) Code:
<!DOCTYPE html> |
If you post any code please put it in between [CODE][/CODE] tags. It makes scanning your posts much easier. You can do this by clicking the small ‘#’ icon above the reply field. Also, in the future, please use a more descriptive subject when posting a question. See posting guidelines.
|
This is a killer:
Code:
else{return document.write('AGUILA!')}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 );Code:
var randomdice = Math.floor( Math.random() * 6 );Your HTML is totally illegal. ALL this code Code:
<img src="d1.gif" name="mydice">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. |
Here, try this:
Code:
<!DOCTYPE html> |
| All times are GMT +1. The time now is 10:25 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.