我有一个像这样的随机图像生成器:
<head>
<script language="JavaScript">
function pickimg(){
var imagenumber = 4 ;
var randomnumber = Math.random() ;
var rand1 = Math.round( (imagenumber-1) * randomnumber) + 1;
images = new Array
images[1] = "image1.jpg"
images[2] = "image2.jpg"
images[3] = "image3.jpg"
images[4] = "image4.jpg"
var image = images[rand1]
document.randimg.src = image
}
</script>
</head>
<body onLoad="pickimg()">
<a href="" onClick="pickimg();return false;"><body onLoad="pickimg()">
<a href="" onClick="pickimg();return false;"><IMG SRC="YOUR IMAGE" name="randimg" border=0 width="100%" height="100%"></a></a>
</body>
当显示 image1.jpg 时,我还想播放 sound1.wav。当显示 image2.jpg 时,我还想播放 sound2.wav 等。
我怎样才能做到这一点?