<% '******************************************************* '* ASP 101 Sample Code - http://www.asp101.com/ * '* * '* This code is made available as a service to our * '* visitors and is provided strictly for the * '* purpose of illustration. * '* * '* http://www.asp101.com/samples/license.asp * '* * '* Please direct all inquiries to webmaster@asp101.com * '******************************************************* %> <% Dim arrColors ' Array of usable colors Dim iMinColor ' LBound of the array Dim iMaxColor ' UBound of the array Dim iR, iG, iB ' Index vars for looping of each color Dim strColor ' Temp var for building color string in loop ' Assign acceptable color components in hex. ' This is the 216 color web-safe palette. arrColors = Array("00", "33", "66", "99", "CC", "FF") ' Note I use the same array for all the colors since ' it's really just a mechanism to hold the hex values. ' I do this to save the processing time that would o/w ' result from doing this computation on each pass of the loop. iMinColor = LBound(arrColors) iMaxColor = UBound(arrColors) ' Table the colors for neat display Response.Write "" & vbCrLf ' Loop through reds For iR = iMinColor To iMaxColor ' Put in a row break so we can see the whole thing on one page Response.Write "" & vbCrLf ' Loop through greens For iG = iMinColor To iMaxColor ' Loop through blues For iB = iMinColor To iMaxColor ' calculate the color and show it strColor = "#" & arrColors(iR) & arrColors(iG) & arrColors(iB) Response.Write "" & vbCrLf Next 'iB Next 'iG Response.Write "" & vbCrLf Next 'iR Response.Write "
" _ & "
" & vbCrLf %>

"> This text will appear in the color you click above.