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;
<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>