- ASP - Random Functions
·Script Writers
·Database Display
·Response Objects
·Server Variables
·Random Events
·What's New?
Mail List


ASP Eight Ball
A website dedicated to web programming would not be complete without it's own version of the Magic 8 Ball.  At least that's our feeling.  Actually, this humble 8 ball script demonstrates three things.  A random number, a dim statement and a tautology that uses a form variable to determine if it's the users first time asking a question.  (Check out some of the other 8 balls on the web The Public 8 Ball, The Magic 8-BallŪ An Unofficial Home Page, Magic 8-ball )
View the Output
Text View
Print View
Mail this Link
Download the Code

<body bgcolor="#FFFFFF">
<!-- Beginning of the Image Form Area -->
<form action="<%= request.servervariables("script_name") %>" method="post">
<input type="hidden" name="u_input" value="Yes">
<input type="image" src="images/8ball.gif">
<!-- End of the Image Form Area -->
<% dim saying(20)
' set the variable saying with 20 dimensions
saying(1)="As I See It, Yes"
saying(2)="Ask Again Later"
saying(3)="Better Not Tell You Now"
saying(4)="Cannot Predict Now"
saying(5)="Concentrate and Ask Again"
saying(6)="Don't Count On It"
saying(7)="It Is Certain"
saying(8)="It Is Decidedly So"
saying(9)="Most Likely"
saying(10)="My Reply Is No"
saying(11)="My Sources Say No"
saying(12)="Outlook Good"
saying(13)="Outlook Not So Good"
saying(14)="Reply Hazy, Try Again"
saying(15)="Signs Point to Yes"
saying(16)="Very Doubtful"
saying(17)="Without a Doubt"
saying(19)="Yes Definitely"
saying(20)="You May Rely On It"
' pick a random number between 1 and 20
' if the user asked a question of the 8 ball display it 
if u_input<> "" then 
response.write saying(random)
' if this is the users first visit display this message instead
response.write "Ask a Question to the 8 Ball<br>and click for your answer"
end if





ASP: What's New? | Articles | Script Writers | Database Display | Read/Write
Server Variables | Response Objects | Random Events | Miscellaneous
HTML: Forms | Hyperlinks | Headers | Tables | Hyperlinks | Headers | Text Display
JavaScript: Document Info | Forms | Images | Navigation | Script Writers
CSS: Basics | Page Display | Text Display | Script Writers | Miscellaneous
  • 2014 michael kors
  • air max women 2013
  • 2014 michael kors
  • air max 2014
  • oakley glasses
  • oakley glasses

  • Maps: Map Script Writers | Bing Maps | Google Maps
  • bottes fr
  • ugg boot
  • Privacy Statement is hosted by
    Donate Food Online with a Mouse Click at
    Donate Land Online with a Mouse Click at
    © 1999 - 2018
    All Rights Reserved

  • Kids jordan 6 rings
  • Jordan retro 10
  • Jordan retro 3