hi,
I am trying to have a table cell with a random image as background. The random image would be chose among four possible images.
I am using this code but it doesn't work:
and then of course the html:
do you see any mistake?
thanks
I am trying to have a table cell with a random image as background. The random image would be chose among four possible images.
I am using this code but it doesn't work:
Code:
<script language="javascript" type="text/javascript">
var img_rnd = new Array ();
img_rnd[0] = "img/background_index_01.jpg";
img_rnd[0] = "img/background_index_02.jpg";
img_rnd[0] = "img/background_index_03.jpg";
img_rnd[0] = "img/background_index_04.jpg";
var i = Math.floor(Math.random() * 4);
document.getElementById('back').bg=img_rnd[i];
//-->
</script>
and then of course the html:
Code:
<td class="index_bottom" id="back" name="back">
do you see any mistake?
thanks