我来回答你吧。。
// JavaScript Document
var m=10; //随机显示图片的总数量
var n=Math.floor(Math.random()*m+1)
document.write ("");
//
上面代码的意思是图片保存在/banner/文件夹下,根据设置的图片总数量,分别放入10张从banner_01.gif到banner_10.gif的图片,在执行这个JS时,它会随机显示从banner_01.gif到banner_10.gif的图片。
保存这个JS为banner.js。
在网页相应的地方写入调用代码就行了。
html
PUBLIC
"-//W3C//DTD
XHTML
1.0
Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
xmlns="http://www.w3.org/1999/xhtml">