top
Loading...
產生隨機滾動信息
產生隨機滾動信息 (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>

北斗有巢氏 有巢氏北斗