<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/htmlcharset=gb2312" />
<title>无标题文档</title>
</head><script language="JavaScript">
today=new Date()
jran=today.getTime()
function rnd() {
ia=9301
ic=49297
im=233280
jran = (jran*ia+ic) % im
return jran/(im*1.0)
}
function rand(number) {
return Math.ceil(rnd()*number)
}
document.write("<center>")
for(i=1i<=1i++) {
myNum=(rand(3))//改成你要随机显示的图片数;
if(myNum == 1) document.write("<img src='1.jpg'>")//图片路径,可用http://
if(myNum == 2) document.write("<img src='2.jpg'>")
if(myNum == 3) document.write("<img src='3.jpg'>")
else {
document.write()
}
}
document.write("</center>")
</script>
<body>
</body>
</html>
var arr=["1.jpg","2.jpg","3.jpg","4.jpg".......]var oImg=Math.floor(Math.random()*arr.length) //随机图
img.src="./img/"+arr[oImg] //img元素得到img文件夹下面的某张图片