function textcolor(color) {
setfocus();
if (helpmode) {
alert(textcolor_help);
} else if (document.selection && document.selection.type == "Text") {
var range = document.selection.createRange();
range.text = "[color=" + color + "]" + range.text + "[/color]";
} else if (advmode) {
AddTxt="[color="+color+"] [/color]";
AddText(AddTxt);
} else {
txt=prompt(textcolor_normal,text_input);
if(txt!=null) {
AddTxt="[color="+color+"]"+txt;
AddText(AddTxt);
AddText("[/color]");
}
}
}
2. 修改 post_bbinsert.htm
var link_normal_input = "{lang post_discuzcode_hyperlink_normal_input}";
var textcolor_help = "設定文字顏色";
var textcolor_normal = "輸入文字";
<table border="0"><tr><td>
</td>
<td width="5"></td>
<td bgcolor="{ALTBG1}"><center>文字顏色
<script language="JavaScript">
var string = '<table cellpadding="0" cellspacing="1" class="cp_table">';
var colours = new Array('FF', 'CC', '99', '66', '33', '00', '00');
var maincol = new Array('FF', 'FF', 'FF', 'CC', '99', '66', '66');
var rgb = new Array();
for (x = 0; x < 6; x++){
rgb.push(colours[x+1] + maincol[x] + maincol[x]);;
rgb.push(colours[x+1] + colours[x+1] + maincol[x]);
rgb.push(maincol[x] + colours[x+1] + maincol[x]);
rgb.push(maincol[x] + colours[x+1] + colours[x+1]);
rgb.push(maincol[x] + colours[x] + colours[x+1]);
rgb.push(maincol[x] + maincol[x] + colours[x+1]);
rgb.push(colours[x+1] + maincol[x] + colours[x+1]);
rgb.push(colours[x] + colours[x] + colours[x]);
string += '<tr>';
for (y = 0; y < rgb.length; y++){
if (rgb[y].length == 4)
rgb[y] == '00' + rgb[y];
string += '<td style="background-color: #' + rgb[y] + '"><a href="javascript:textcolor(\'#' + rgb[y] + '\');" ><img src="images/common/transparent.gif" height="8" width="8" alt="#' + rgb[y] + '" border="0" /></a></td>';
}
string += '</tr>';
rgb = new Array();
}
string += '</table>';
document.write(string);
</script>
</center>
</td></tr></table>
</td>
</tr>
<!--{/if}-->