CodeAve.com CodeAve.com - ASP - Miscellaneous
ASP
·Read/Write
·Script Writers
·Database Display
·Response Objects
·Server Variables
·Random Events
·Articles
·Miscellaneous
·Contents
·What's New?
JavaScript
CSS
HTML
Maps
Links
Mail List
Search
Sitemap


 


Select Case
Select Case allows for multiple decision paths providing you are checking for one possible condition.  While an if then statement can have virtually any combination of conditions within it (example: if (x=1) and ((y=2) or (z>50)) then proceed ) select case can only evaluate one element at time.  The following example will generate a random number from zero to six and depending upon that variable value display a message.
View the Output
Text View
Print View
Mail this Link
Download the Code

<html>
<title>CodeAve.com(Select Case)</title>
<body bgcolor="#FFFFFF">
<%
' select a random number between 0 and 6 
randomize
random_number=int(rnd*6)
' start the select case routine by naming 
' the variable that you will be querying 
select case random_number
' if the random number equals 1 then
' the following text will be displayed
case "1"
%>

One was chosen
<% 
' if 0 is chosen the following asp will execute
' this also demonstrates that the values do not need
' to go in ascending order
case "0" 
response.write "Zero was selected"
%>
<%
' if the random number is between two and four 
' the following text will display. Notice the comma
' sepration of the quoted value range
case "2", "4", "3" %>

A number between two and four was chosen
<%
' if none of the other requirements were satisfied
' or if the random number value had been null
case else %>

Out of range or null
<%
' terminate the select routine
end select %>

 

 

 



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

    CodeAve.com is hosted by MyHosting.com
    Donate Food Online with a Mouse Click at TheHungerSite.com
    Donate Land Online with a Mouse Click at TheRainForestSite.com
    © 1999 - 2017 CodeAve.com
    All Rights Reserved

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