This code isn't working properly!

February 23, 2012 at 17:28:04
Specs: Windows XP
I tried out the following code, but it shows up as blank. Could someone find the error? (Also, it is a Draw-a-Card type of game, incase anyone is curious)

<script type="text/javascript">
var randomnumber=Math.floor(Math.random()*11)
// Only change text in " " marks, this is what the person will see.
randomnumber[1] = "You get no prize";
randomnumber[2] = "You get no prize";
randomnumber[3] = "You get no prize";
randomnumber[4] = "You get no prize";
randomnumber[5] = "Prize code1";
randomnumber[6] = "Prize code1";
randomnumber[7] = "Prize code1";
randomnumber[8] = "Prize code2";
randomnumber[9] = "Prize code2";
randomnumber[10] = "Prize code3";
// Prize code# is where you put in a prize
// The higher number indicates more difficulty to get

See More: This code isnt working properly!

Report •

March 13, 2012 at 22:52:44
1.) You need to add a semi-colon at the end of the var randomnumber line.
2.) You didn't print out the variable, assuming you got it to select the appropriate item within the array.

Apologies if I don't respond to your reply immediately. I don't check this site daily, but you're welcome to PM me as a reminder.

Report •
Related Solutions

Ask Question