webForumDet fria alternativet

Webbsäkra färger

ASP

1 svar · 5 630 visningar · startad av Palle

Medlem sedan apr. 20003 174 inlägg
Frågan#1

Ett litet script för er som på ett eller annat sätt behöver visa en lista över webbsäkra färger. :)

Exempel

[red]<table cellspacing="1">
<%

Dim arrColors, strColorPart1, strColorPart2, strColorPart3, x, y, z

arrColors = array("FF","CC","99","66","33","00")

For x = 0 To 5
	strColorPart1 = arrColors(x)
	Response.Write vbcrlf &"<tr>"
	For y = 0 To 5
		strColorPart2 = arrColors(y)
		For z = 0 To 5
			strColorPart3 = arrColors(z)
			Response.Write vbcrlf &"<td style=""width: 10px; background: #"& strColorPart1 & strColorPart2 & strColorPart3 &";"">&amp;nbsp;</td>"
		Next
	Next
	Response.Write vbcrlf &"</tr>"
Next

%>
</table>[/red]
Medlem sedan nov. 20017 144 inlägg
#2

Liten "förbättring". Klicka på färgen och få färgkoden i ett textfält.

<table cellspacing="1">
<%

Dim arrColors, strColorPart1, strColorPart2, strColorPart3, x, y, z

arrColors = array("FF","CC","99","66","33","00")

For x = 0 To 5
	strColorPart1 = arrColors(x)
	Response.Write vbcrlf &"<tr>"
	For y = 0 To 5
		strColorPart2 = arrColors(y)
		For z = 0 To 5
			strColorPart3 = arrColors(z)
			Response.Write vbcrlf &"<td onclick=""document.foo.bar.value=this.style.background;"" style=""width: 10px; background: #"& strColorPart1 & strColorPart2 & strColorPart3 &";"">&nbsp;</td>"
		Next
	Next
	Response.Write vbcrlf &"</tr>"
Next

%>
</table>
<form name="foo">
<input type="text" name="bar">
</form>
264 ms totalt · 4 externa anrop · v20260731065814-full.86ec41c2
131 ms — deklarationer (db)
0 ms — hämta statistik (cache)
130 ms — hämta tråd, inlägg och bilagor (db)
129 ms — ändringar (db)