JS

유용한 색상 선택툴

부니기 2008. 5. 24. 03:29
데모 :

* 색상을 Click해 주세요.

Sample Code :

<html>
<head>
	<title>Lewies Color Picker Demonstration</title>
	<script language=javascript>
	<!--
		function OpenColorPicker(){
			var hex = new String(Color.style.backgroundColor);
			try
			{
				hex = window.showModalDialog("/lib/color/ColorPicker.htm", hex, 
"dialogWidth:488px;dialogHeight:323px;help:no;center:yes;status:no;");
				if(hex != null) {
					Color.style.backgroundColor = "#" + hex;
					document.f1.COL1.value = "#" + hex;
				}
			}
			catch(e)
			{
				alert("Your browser does not appear to support modal dialog boxes.");
				// insert code here to use a color picker that is more
				// compatable accross browsers.
			}
		}
	//-->
	</script>
</head>
<body>
	<form name=f1>
	<div id="Color" onclick="OpenColorPicker()" 
style="width:100px;height:100px;border:1px solid black;background-color:#0000FF"></div>
	<input type=text name=COL1>
	</form>
</body>
</html>


다운로드 :