产生随机滚动信息

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

RND函数

INT函数

SELECT CASE

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

1<html><head>
2<title>randomadvice.asp</title>
3</head>
4<body bgcolor="#FFFFFF">   

' generate a random number 1-6
randomize
randomnum=int(rnd*6)+1
SELECT CASE randomnum
CASE 1,2,3

1Plant your crops early this year<br/>   
2No frost expected<br/>   

CASE 4

1Never play cards<br/>with a man named after a city<br/>   

CASE 5

1You can never be too rich, too thin or backup too often<br/>   

CASE 6

1A swallow keeps away the stork<br/>   

END SELECT

1</body></html>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus