quote.asp
<%
Set MyFileObj = Server.CreateObject("Scripting.FileSystemObject")
Set MyTextFile = MyFileObj.OpenTextFile("c:\quote.txt")
' 设置好路径.
IF NOT MyTextFile.AtEndOfStream THEN
header = CInt(MyTextFile.ReadLine)
' 读表头.
END IF
RANDOMIZE
' 生成基于表头的随机数, RANDOMIZE语句对确保一个随机数非常重要.
RandomValue = INT(header*RND)+1
Count=0
' 循环直到行号等于随机数,保存在变量引用.
WHILE NOT MyTextFile.AtEndOfStream AND NOT Count = RandomValue
quote = MyTextFile.ReadLine
Count = Count + 1
WEND
' 关闭文本文件.
MyTextFile.Close
%>
<html>
<body>
现在引用的是: <%=quote%>
</body></html>
[1]
本文章来源于网络,作者是:,由代码部落进行采编,如涉及侵权请联系删除!转载请注明出处:https://daimabuluo.cc/biancheng10000wen/1105.html