|
This is a neat random quote example . Firstly add the following
code to your page you want the quotes to appear on.
<%
'pick a random entry from 1 to 10
Randomize
NumberOfQuotes = Int(Rnd*10)
'open the quotes file
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set InStream = fso.OpenTextFile(Server.MapPath("/quotes")
& "/quotes.txt",1,false,false)
For i = 1 to NumberOfQuotes - 1
InStream.SkipLine()
Next
'assign the variable to the selected quote
NumberOfQuotes = InStream.ReadLine
%>
Now to display the result on your page place the following
where you wish the quotes to appear.
<%= NumberOfQuotes%>
Now create a folder called quotes and a text file called quotes.txt
. In this text file create 10 seperate lines of text. You can
download my text file from the link below
quotes.txt
|