Bilgisayar Bölümü ASP Kod ve Script Arşivi


Random quote generator

<%

'***Random quote generator that uses
'***random numbers And a Select Case statement

'***Define your variables
Dim RandomNumber, Quote, Author

'*** Randomize so that your computer doesn't start
'*** from the same place In memory every time it
'*** generates a random number
Randomize

'*** Generate a random number between 1 And 6
'*** Rnd generates a random number between 0 And 1.
'*** We multiply by 6 To specify a range.
'*** Then we Get rid of the Decimal by using the
'*** Integer Function (Int). After that we
'*** add 1 To make sure we don't Get a 0.
RandomNumber = Int(Rnd * 6) + 1

'*** Use Select Case To Get quote And author
Select Case RandomNumber

Case ""1""
Quote=""I have Not failed. I've just found 10,000 ways that won't work.""
Author=""Thomas Edison""
Case ""2""
Quote=""Only two things are infinite, the universe And human stupidity, And I'm Not sure about the former.""
Author=""Albert Einstein""
Case ""3""
Quote=""My advice To you Is Get married: If you find a good wife you'll be happy; If Not, you'll become a philosopher.""
Author=""Socrates""
Case ""4""
Quote=""640K ought To be enough For anybody.""
Author=""Bill Gates""
Case ""5""
Quote=""Never interrupt your enemy when he Is making a mistake.""
Author=""Napoleon Bonaparte""
Case ""6""
Quote=""Do, Or Do Not. There Is no 'try'.""
Author=""Yoda""

End Select

'*** Format And display the random quote
Response.Write Quote & ""<br><i>-"" & Author & ""</i>""

%>
"

ASP Kitabı

 

Faydalılar: Altın Fiyatları |Hediye Kolye | pırlanta fiyatları
Ana Sayfa  Sık Kullanılanlara Ekle   admin[at]bilgisayarbolumu.com | © 2006 - 2022 Bilgisayarbolumu.com