해외사이트에서 퍼온 소스입니다. 칼라테이블이 나오고 테이블을 클릭하면 그 테이블의 컬러로 텍스트 색상을 변경해줍니다. 웹서버에 넣고 돌려보니 잘 돌아갑니다.
<% 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 "<table cellspacing=""0"" cellpadding=""0"" " _ & "border=""0"">" & 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 "<tr>" & 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 "<td bgcolor=""" & strColor & """>" _ & "<a href=""color_chooser.asp?color=" & Server.URLEncode(strColor) _ & """><img src=""images/spacer.gif"" width=""15"" height=""15"" " _ & "alt=""" & strColor & """ border=""0""></a></td>" & vbCrLf Next 'iB Next 'iG Response.Write "</tr>" & vbCrLf Next 'iR Response.Write "</table>" & vbCrLf %>
<p> <strong> <font size="+2" color="<%= Request.QueryString("color") %>"> This text will appear in the color you click above. </font> </strong> </p>
|
|
|