Color Dialog Box 사용하기 > script

본문 바로가기
사이트 내 전체검색

script

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();">


 <INPUT TYPE="button" ID="ofntColor" VALUE="폰트색상선택" onclick="callColorDlg()">

<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

첨부파일

댓글목록

등록된 댓글이 없습니다.

Total 846건 53 페이지
게시물 검색

회원로그인

접속자집계

오늘
119
어제
225
최대
1,347
전체
154,878
Latest Crypto Fear & Greed Index

그누보드5
Copyright © 서방님.kr All rights reserved.