<SCRIPT> 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> <BUTTON ID="ofntColor" TITLE="Choose Font Color" onclick="callColorDlg()">Choose Font color</BUTTON> <br> <br> <DIV id=oDiv CONTENTEDITABLE ALIGN=left STYLE="height:100; background-color:white; font-size:15pt; font-family:Arial; padding:10; border:2px inset #eeeeee; overflow:auto;"> Click the button to choose a font color using the choose color dialog. </DIV> <!--Create the Dialog Helper Object--> <OBJECT id=dlgHelper CLASSID="clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b" width="0px" height="0px"></OBJECT> [Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]