ตัวอย่าง

 

พิมพ์ชื่อสีที่ต้องการให้แสดงรหัสสี    

 

1. Code1 ใส่ใน Tag <head>
2. Code2 ใส่ใน Tag <body> ตรงที่จะให้แสดงข้อความ
Code1
 

<SCRIPT Language="JavaScript">

Idx = new Object();

Idx["aliceblue"]="F0F8FF"

Idx["antiquewhite"]="FAEBD7"

Idx["aqua"]="00FFFF"

Idx["aquamarine"]="7FFFD4"

Idx["azure"]="F0FFFF"

Idx["beige"]="F5F5DC"

Idx["bisque"]="FFE4C4"

Idx["black"]="000000"

Idx["blanchedalmond"]="FFEBCD"

Idx["blue"]="0000FF"

Idx["blueviolet"]="8A2BE2"

Idx["brown"]="A52A2A"

Idx["burlywood"]="DEB887"

Idx["cadetblue"]="5F9EA0"

Idx["charteuse"]="7FFF00"

Idx["chocolate"]="D2691E"

Idx["coral"]="FF7F50"

Idx["cornflowerblue"]="6495ED"

Idx["cornsilk"]="FFF8DC"

Idx["crimson"]="DC143C"

Idx["cyan"]="00FFFF"

Idx["darkblue"]="00008B"

Idx["darkcyan"]="008B8B"

Idx["darkgoldenrod"]="B8860B"

Idx["darkgray"]="A9A9A9"

Idx["darkgreen"]="006400"

Idx["darkkhaki"]="BDB76B"

Idx["darkmagenta"]="8B008B"

Idx["darkolivegreen"]="556B2F"

Idx["darkorange"]="FF8C00"

Idx["darkorchid"]="9932CC"

Idx["darkred"]="8B0000"

Idx["darksalmon"]="E9967A"

Idx["darkseagreen"]="8FBC8F"

Idx["darkslateblue"]="483D8B"

Idx["darkslategray"]="2F4F4F"

Idx["darkturquoise"]="00CED1"

Idx["darkviolet"]="9400D3"

Idx["deeppink"]="FF1493"

Idx["deepskyblue"]="00BFFF"

Idx["dimgray"]="696969"

Idx["dodgerblue"]="1E90FF"

Idx["firebrick"]="B22222"

Idx["floralwhite"]="FFFAF0"

Idx["forestgreen"]="228B22"

Idx["fushia"]="FF00FF"

Idx["gainsboro"]="DCDCDC"

Idx["ghostwhite"]="F8F8FF"

Idx["gold"]="FFD700"

Idx["goldenrod"]="DAA520"

Idx["gray"]="808080"

Idx["green"]="008000"

Idx["greenyellow"]="ADFF2F"

Idx["honeydew"]="F0FFF0"

Idx["hotpink"]="FF69B4"

Idx["indianred"]="CD5C5C"

Idx["indigo"]="4B0082"

Idx["ivory"]="FFFFF0"

Idx["khaki"]="F0E68C"

Idx["lavender"]="E6E6FA"

Idx["lavenderblush"]="FFF0F5"

Idx["lawngreen"]="7CFC00"

Idx["lemonchiffon"]="FFFACD"

Idx["lightblue"]="ADD8E6"

Idx["lightcoral"]="F08080"

Idx["lightcyan"]="E0FFFF"

Idx["lightgoldenrodyellow"]="FAFAD2"

Idx["lightgreen"]="90EE90"

Idx["lightgrey"]="D3D3D3"

Idx["lightpink"]="FFB6C1"

Idx["lightsalmon"]="FFA07A"

Idx["lightseagreen"]="20B2AA"

Idx["lightskyblue"]="87CEFA"

Idx["lightslategray"]="778899"

Idx["lightsteelblue"]="B0C4DE"

Idx["lightyellow"]="FFFFE0"

Idx["lime"]="00FF00"

Idx["limegreen"]="32CD32"

Idx["linen"]="FAF0E6"

Idx["magenta"]="FF00FF"

Idx["maroon"]="800000"

Idx["mediumaquamarine"]="66CDAA"

Idx["mediumblue"]="0000CD"

Idx["mediumorchid"]="BA55D3"

Idx["mediumpurple"]="9370DB"

Idx["mediumseagreen"]="3CB371"

Idx["mediumslateblue"]="7B68EE"

Idx["mediumspringgreen"]="00FA9A"

Idx["mediumthrquoise"]="48D1CC"

Idx["mediumvoiletred"]="C71585"

Idx["midnightblue"]="191970"

Idx["mintcream"]="F5FFFA"

Idx["mistyrose"]="FFE4E1"

Idx["moccasin"]="FFE4B5"

Idx["navajowhite"]="FFDEAD"

Idx["navy"]="000080"

Idx["oldlace"]="FDF5E6"

Idx["olive"]="808000"

Idx["olivedrab"]="6B8E23"

Idx["orange"]="FFA500"

Idx["orangered"]="FF4500"

Idx["orchid"]="DA70D6"

Idx["palegoldenrod"]="EEE8AA"

Idx["palegreen"]="98FB98"

Idx["paleturquoise"]="AFEEEE"

Idx["palevioletred"]="DB7093"

Idx["papayawhip"]="FFEFD5"

Idx["peachpuff"]="FFDAB9"

Idx["peru"]="CD853F"

Idx["pink"]="FFC0CB"

Idx["plum"]="DDA0DD"

Idx["powderblue"]="B0E0E6"

Idx["purple"]="800080"

Idx["red"]="FF0000"

Idx["rosybrown"]="BC8F8F"

Idx["royalblue"]="4169E1"

Idx["saddlebrown"]="8B4513"

Idx["salmon"]="FA8072"

Idx["sandybrown"]="F4A460"

Idx["seagreen"]="2E8B57"

Idx["seashell"]="FFF5EE"

Idx["sienna"]="A0522D"

Idx["silver"]="C0C0C0"

Idx["skyblue"]="87CEEB"

Idx["slateblue"]="6A5ACD"

Idx["slategray"]="708090"

Idx["snow"]="FFFAFA"

Idx["springgreen"]="00FF7F"

Idx["steelblue"]="4682B4"

Idx["tan"]="D2B48C"

Idx["teal"]="008080"

Idx["thistle"]="D8BFD8"

Idx["tomato"]="FF6347"

Idx["turquoise"]="40E0D0"

Idx["violet"]="EE82EE"

Idx["wheat"]="F5DEB3"

Idx["white"]="FFFFFF"

Idx["whitesmokes"]="F5F5F5"

Idx["yellow"]="FFFF00"

Idx["yellowgreen"]="9ACD32"

 

function checkDatabase() {

var Item = document.testform.color.value.toLowerCase();

if( Idx[Item] != null )

alert ("รหัสสี '" + Item + "' คือ.. #" +Idx[Item])

else

alert ("ขอโทษครับ, สี '" + Item +"' ไม่มีรายชื่ออยู่ในฐานข้อมูล");

 

 

}

</SCRIPT>

Code2
<FORM NAME="testform" onSubmit="checkDatabase()">

<center><FONT face="MS Sans Serif" SIZE=2> พิมพ์ชื่อสีที่ต้องการให้แสดงรหัสสี &nbsp;

<INPUT TYPE="text" NAME="color" Value="" onClick=0>&nbsp;

<INPUT TYPE="button" NAME="button" Value="แสดงรหัสสี" onClick="checkDatabase()">

</center>

</FORM>

 

[ Home ]  [ Chatroom ]  [ Board 1]  [Board 2 ]  [ Book ]  [ Sourcecode ]  [ Free ]  [ Servicesite ]  [ Link ]

1