Random Color

Another random example , this time we will change the color . In this example we change the font color but you could change the background color or the horizontal rule color to name some more examples .

Code :

<%
Dim intNumber , strColor
'produce a random number between 1 and 5
Randomize
intNumber = int(Rnd * 5) + 1
'depending on the number produced store a color in the
'variable strColor
Select Case intNumber
Case "1"
strColor = "blue"
Case "2"
strColor = "red"
Case"3"
strColor = "green"
Case"4"
strColor ="brown"
Case"5"
strColor ="aqua"
End Select
%>
<font color = '<%= strColor %>'>This is random colored text</font>

 

Books

cover

Asp Developer's Guide (The Application...

cover


Professional ASP .NET


cover


Asp Developer's Guide (The Application...