其中img文件夹里面有5张jpg图片,
   random r = new random();
   string path = "img/"+r.next(1,5)+".jpg"; 
   //输出格式
   response.contenttype = "image/jpeg";
   //输出文件
   response.writefile(path);
   response.end(); 
复杂点的话可以遍历某个文件夹里面的所有文件名.....
不懂的话看看asp版本的找点灵感
asp版本的
<%
randomize
dim url,total
total=10 '圖片總數
url="images/pic"&((int(rnd()*100000) mod total) +1)&".jpg"
'eg:
'url="images/pic1.jpg"
'url="images/pic8.jpg"
'.........
%>
<img src="<%=url%>"/>
简单了点...
新闻热点
疑难解答