当前位置: 首页 > 图文教程 > 网络编程 > ASP > 产生随机滚动信息

ASP
ASP设计常见问题及解答精要-1
ASP设计常见问题及解答精要-2
ASP设计常见问题及解答精要-3
ASP设计常见问题及解答精要-4
asp学习入门经验谈
如何才能成为一名真正的Web程序员
手把手教你在ASP中使用SQL语句
ASP与数据库应用(给初学者)
亲密接触ASP.Net(1)
亲密接触ASP.Net(2)
亲密接触ASP.Net(3)
亲密接触ASP.Net(4)
亲密接触ASP.Net(5)
.Net边学边讲(一)
.Net边学边讲(二)
.Net边学边讲(三)
NET移植案例学习:建造Web站点(1)
NET移植案例学习:建造Web站点(2)
ASP 3.0高级编程(四十)
深入研究Application和Session对象(1)

ASP 中的 产生随机滚动信息


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 131 ::
收藏到网摘: n/a

  产生随机滚动信息 (Charles Carroll/蜘蛛精 译)
Random Advice / Rotating Information by Charles Carroll
本页演示了通过产生随机数的方式实现出现随机滚动信息的方法

RND函数

INT函数

SELECT CASE

代码randomadvice.asp演示了当每次页面被刷新时,上面的会随机出现不同的信息

<html><head>
<TITLE>randomadvice.asp</TITLE>
</head>
<body bgcolor="#FFFFFF">
<%
' generate a random number 1-6
randomize
randomnum=int(rnd*6)+1
SELECT CASE randomnum
CASE 1,2,3%>
   Plant your crops early this year<br>
   No frost expected<br>
<%CASE 4%>
   Never play cards<br>with a man named after a city<br>
<%CASE 5%>
   You can never be too rich, too thin or backup too often<br>
<%CASE 6%>
   A swallow keeps away the stork<br>
<%END SELECT%>
</body></html>