Color Dialog Box 사용하기
페이지 정보
작성자 서방님 댓글 0건 조회 178회 작성일 06-09-12 17:23본문
* <Head>와 </Head>사이에 아래 스크립트를 추가하세요.
<SCRIPT LANGUAGE="JavaScript">
<!--
function fnInit(){
for (i=0; i<document.all.length; i++)
document.all(i).unselectable = "on";
}
var sInitColor = null;
function callColorDlg(){
if (sInitColor == null)
//display color dialog box
var sColor = dlgHelper.ChooseColorDlg();
else
var sColor = dlgHelper.ChooseColorDlg(sInitColor);
//change decimal to hex
sColor = sColor.toString(16);
//add extra zeroes if hex number is less than 6 digits
if (sColor.length < 6) {
var sTempString = "000000".substring(0,6-sColor.length);
sColor = sTempString.concat(sColor);
}
//change color of the text in the div
oDiv.style.color= sColor;
sInitColor = sColor;
}
//-->
</SCRIPT>
* <Body></Body>태그 사이에 아래 처럼 추가해서 사용하세요.
<BODY onload="fnInit();">
<DIV id=oDiv CONTENTEDITABLE>
Color Dialog Box에서 선택한 색상이 폰트에 적용될 내용
</DIV>
<!--Create the Dialog Helper Object-->
<OBJECT id=dlgHelper CLASSID="clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b" width="0px" height="0px"></OBJECT>
자료출처 : http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/choosecolordlg.asp
첨부파일
- ColorDialogShowMe.html (2.2K) 2회 다운로드 | DATE : 2008-09-08 11:41:02
댓글목록
등록된 댓글이 없습니다.