📄 selectstyle.htm
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312" />
<title>字体</title>
</head>
<script language="javascript" type="text/javascript">
var FONT_NAME = Array(
'Arial', 'Arial Black', 'Courier New', 'Garamond', 'Georgia', 'Tahoma', 'Verdana', 'Times New Roman', 'GulimChe', 'MS Gothic','方正舒体','方正姚体','仿宋','黑体','华文彩云','华文仿宋','华文行楷','华文琥珀','华文楷体','华文隶书','华文宋体','华文细黑','华文新魏','华文中宋','楷体','隶书','宋体','微软雅黑','新宋体','幼圆'
);
var FONT_SIZE = Array(
Array('8pt','xx-small ( 8 pt)'),
Array('10pt','x-small (10 pt)'),
Array('12pt','small (12 pt)'),
Array('14pt','medium (14 pt)'),
Array('18pt','large (18 pt)'),
Array('24pt','x-large (24 pt)'),
Array('36pt','xx-large (36 pt)')
);
var Text_Decoration = Array(
'line-through','underline','overline'
);
function Result(cmd,value){
if(value != null) {
var PreviewObject = document.getElementById('PreviewText');
switch(cmd){
case "FontFamily":
PreviewObject.style.fontFamily = value;
break;
case "FontSize":
PreviewObject.style.fontSize = value;
break;
case "FontColor":
PreviewObject.style.color = value;
break;
case "BgColor":
PreviewObject.style.backgroundColor = value;
break;
case "FontBold":
PreviewObject.style.fontWeight = 'normal';
PreviewObject.style.fontStyle = 'normal';
if(value == 'bold')
PreviewObject.style.fontWeight = value;
else if(value == 'italic')
PreviewObject.style.fontStyle = value;
else if(value == 'bold italic'){
PreviewObject.style.fontWeight = 'bold';
PreviewObject.style.fontStyle = 'italic';
}
break;
case "TextDecoration":
if(PreviewObject.style.textDecoration.indexOf(value)<0)
PreviewObject.style.textDecoration += ' '+value;
else{
PreviewObject.style.textDecoration = PreviewObject.style.textDecoration.replace(value,'');
PreviewObject.style.textDecoration = PreviewObject.style.textDecoration.replace(' ','');
}
break;
}
}
}
function ReturnStyle(){
var SubjectObject = parent.document.getElementById('Subject');
var PreviewObject = document.getElementById('PreviewText');
SubjectObject.style.fontFamily = PreviewObject.style.fontFamily;
SubjectObject.style.fontSize = PreviewObject.style.fontSize;
SubjectObject.style.color = PreviewObject.style.color;
SubjectObject.style.backgroundColor = PreviewObject.style.backgroundColor;
SubjectObject.style.fontWeight = PreviewObject.style.fontWeight;
SubjectObject.style.fontStyle = PreviewObject.style.fontStyle;
SubjectObject.style.textDecoration = PreviewObject.style.textDecoration;
var SubjectStyle = '';
if(PreviewObject.style.fontFamily.length >1)SubjectStyle += 'font-family:'+PreviewObject.style.fontFamily +';';
if(PreviewObject.style.fontSize.indexOf('pt')>0)SubjectStyle += 'font-size:'+PreviewObject.style.fontSize +';';
if(PreviewObject.style.color.length>3)SubjectStyle += 'color:'+PreviewObject.style.color +';';
if(PreviewObject.style.backgroundColor.length>3)SubjectStyle += 'background:'+PreviewObject.style.backgroundColor +';';
if(PreviewObject.style.fontWeight == 'bold')SubjectStyle += 'font-weight:'+PreviewObject.style.fontWeight +';';
if(PreviewObject.style.fontStyle == 'italic')SubjectStyle += 'font-style:'+PreviewObject.style.fontStyle +';';
if(PreviewObject.style.textDecoration.length >7)SubjectStyle += 'text-decoration:'+PreviewObject.style.textDecoration +';';
parent.document.getElementById('ThreadStyle').value = SubjectStyle;
parent.BBSXP_Modal.Close();
}
function ClearStyle(){
SubjectObject.style.fontFamily = '';
SubjectObject.style.fontSize = '';
SubjectObject.style.color = '';
SubjectObject.style.backgroundColor = '';
SubjectObject.style.fontWeight = '';
SubjectObject.style.fontStyle = '';
SubjectObject.style.textDecoration = '';
parent.document.getElementById('ThreadStyle').value = '';
parent.BBSXP_Modal.Close();
}
</script>
<script type="text/javascript" src="selectColor.js"></script>
<body style="font-size:10pt;">
<fieldset>
<legend>基本设置</legend>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>字体:</td>
<td>字体样式:</td>
<td>大小:</td>
</tr>
<tr>
<td>
<select size="6" name="FontFamily" onchange="Result('FontFamily',this.options[this.selectedIndex].value);">
<option value="">(默认字体)</option>
<script language="javascript" type="text/javascript">
for (i = 0; i<FONT_NAME.length; i++){
if(FONT_NAME[i] == parent.document.getElementById('Subject').style.fontFamily)
document.write('<option value="'+FONT_NAME[i]+'" selected>'+FONT_NAME[i]+'</option>');
else
document.write('<option value="'+FONT_NAME[i]+'">'+FONT_NAME[i]+'</option>');
}
</script>
</select>
</td>
<td>
<select size="6" name="FontBold" onchange="Result('FontBold',this.options[this.selectedIndex].value);" style="width:110px">
<option value="">(默认样式)</option>
<script language="javascript" type="text/javascript">
var SubjectObject = parent.document.getElementById('Subject');
if(SubjectObject.style.fontStyle == 'italic')
document.writeln('<option value="italic" selected>倾斜</option>');
else
document.writeln('<option value="italic">倾斜</option>');
if(SubjectObject.style.fontWeight == 'bold')
document.writeln('<option value="bold" selected>加粗</option>');
else
document.writeln('<option value="bold">加粗</option>');
if(SubjectObject.style.fontWeight == 'bold' && SubjectObject.style.fontStyle == 'italic')
document.writeln('<option value="bold italic" selected>加粗 倾斜</option>');
else
document.writeln('<option value="bold italic">加粗 倾斜</option>');
</script>
</select>
</td>
<td>
<select size="6" name="FontSize" onchange="Result('FontSize',this.options[this.selectedIndex].value);" style="width:110px">
<option value="">(默认大小)</option>
<script language="javascript" type="text/javascript">
for (i = 0; i<FONT_SIZE.length; i++){
if(FONT_SIZE[i][0] == parent.document.getElementById('Subject').style.fontSize)
document.write('<option value="'+FONT_SIZE[i][0]+'" selected>'+FONT_SIZE[i][1]+'</option>');
else
document.write('<option value="'+FONT_SIZE[i][0]+'">'+FONT_SIZE[i][1]+'</option>');
}
</script>
</select>
</td>
</tr>
</table>
</fieldset>
<br />
<fieldset>
<legend>效果</legend>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="25px">
<tr>
<td width=8%> </td>
<td>
<span onclick="OpenColorPicker('FontColor', event)" style="cursor:pointer" title="点击选择颜色"><img id="FontColor" style="background:#000; border:0;margin-right:3px" src="../Images/rect.gif" align="absmiddle" />文字颜色</span>
</td>
<td>
<span onclick="OpenColorPicker('BgColor', event)" style="cursor:pointer" title="点击选择颜色"><img id="BgColor" style="background:#FFF; border:0;margin-right:3px" src="../Images/rect.gif" align="absmiddle" />突出颜色</span>
</td>
<td><label for="underline"><input id="underline" name="TextDecoration" type="checkbox" value="underline" onclick="Result('TextDecoration',this.value)" />下划线</label></td>
<td><label for="line-through"><input id="line-through" name="TextDecoration" type="checkbox" value="line-through" onclick="Result('TextDecoration',this.value)" />删除线</label></td>
<td><label for="overline"><input id="overline" name="TextDecoration" type="checkbox" value="overline" onclick="Result('TextDecoration',this.value)" />上划线</label></td>
</tr>
</table>
</fieldset>
<br />
<fieldset>
<legend>预览</legend>
<table width="100%" height="32" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height=100px style="border:1px solid #666;" align=center><span id=PreviewText style="">BBSXP论坛</span></td>
</tr>
</table>
</fieldset>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><input type=button value=" 确定 " onclick="ReturnStyle();" /> <input type=button onclick="parent.BBSXP_Modal.Close();" value=" 取消 " /> <input type=button onclick="ClearStyle();" value=" 删除效果 " /></td>
</tr>
</table>
<script language="javascript" type="text/javascript">
var SubjectObject = parent.document.getElementById('Subject');
var PreviewObject = document.getElementById('PreviewText');
if (parent.document.getElementById('Subject').value != '')
PreviewObject.innerHTML = SubjectObject.value;
PreviewObject.style.fontFamily = SubjectObject.style.fontFamily;
PreviewObject.style.fontSize = SubjectObject.style.fontSize;
PreviewObject.style.color = SubjectObject.style.color;
PreviewObject.style.backgroundColor=SubjectObject.style.backgroundColor;
PreviewObject.style.fontWeight = SubjectObject.style.fontWeight;
PreviewObject.style.fontStyle = SubjectObject.style.fontStyle;
PreviewObject.style.textDecoration = SubjectObject.style.textDecoration;
if(SubjectObject.style.color.length>3)
document.getElementById('FontColor').style.backgroundColor = SubjectObject.style.color;
document.getElementById('BgColor').style.backgroundColor = SubjectObject.style.backgroundColor;
for(i=0; i<Text_Decoration.length; i++){
if(parent.document.getElementById('Subject').style.textDecoration.indexOf(Text_Decoration[i])>=0){
document.getElementById(Text_Decoration[i]).checked = true;
}
}
</script>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -