html
<div class="randomPic">

</div>
JS
window.onload = function(){
var a = new Array();
a[0] = 'pic1.png';
a[1] = 'pic2.png';
var b = Math.floor(Math.random()*10+1);
$("#imgId").attr('src','images/' + a[b%2]); //%为取余
}
网友评论