Hi I am trying to create a picture bingo for my website. I am using the traditional bingo card generator with the following code:
window.onload = newCard;
var usedNums = new Array(76);
function newCard() {
if (document.getElementById) {
for (var i=0; i<24; i++) {
setSquare(i);
}
}
else {
alert("Sorry, your browser doesn't support this script");
}
}
function setSquare(thisSquare) {
var currSquare = "square" + thisSquare;
var colPlace = new Array(0,1,2,3,4,0,1,2,3,4,0,1,3,4,0,1,2,3,4,0,1,2,3,4);
var colBasis = colPlace[thisSquare] * 15;
var newNum;
do {
newNum = colBasis + getNewNum() + 1;
}
while (usedNums[newNum]);
usedNums[newNum] = true;
document.getElementById(currSquare). innerHTML = newNum;
}
function getNewNum() {
return Math.floor(Math.random() * 15);
}
My Question is that once the number is generated, can anyone tell me what code I should use to change the number into an image?
I would like to say if the number 1 is chosen then display a the picture from 123picture.jpg (i.e.). Can anyone help? I would greatly appreciate it…
Thanks!
Joe