学院首页>网络编程>ASP>产生随机滚动信息

产生随机滚动信息

作者:未知 来源:未知 添加时间:2006-5-21 10:31:28
产生随机滚动信息 (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

No frost expected

<%CASE 4%>
Never play cards
with a man named after a city

<%CASE 5%>
You can never be too rich, too thin or backup too often

<%CASE 6%>
A swallow keeps away the stork

<%END SELECT%>
</body></html>  
站内搜索