复制代码代码如下:
<span style = "font-size: 14px;"> <! Doctype html public "-// w3c // dtd xhtml 1.0 Transitional // en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transicional.dtd ">
<html xmlns = "http://www.w3.org/1999/xhtml">
<Evista>
<meta http-equiv = "content-type" content = "text/html; charset = utf-8">
<title> 富文本编辑器 </title>
</ablo>
<Body>
<FieldSet>
<legend> 编辑区 </legend>
<div>
<form>
字体颜色 :
<select onChange = "setFontColor (this)">
<opción valor = "negro"> negro </opción>
<opción valor = "rojo"> rojo </opción>
<opción valor = "verde"> verde </opción>
<opción valor = "azul"> azul </opción>
</select>
字体样式 :
<select onchange = "setFontStyle (this)">
<opción value = "Bold"> Bold </opción>
<opción valor = "italic"> italic </ppection>
<opción valor = "subraye"> subraye </ppection>
<opción valor = "striketthrough"> striketthrough </ppection>
</select>
字体名称 :
<select onchange = "setFontfamily (this)">
<opción valor = "serif"> serif </ppection>
<opción valor = "sans-serif"> sans-serif </ppection>
<opción value = "monoSpace"> monoSospace </ppection>
<opción valor = "cómic sans ms"> cómic sans </opción>
</select>
</form>
</div>
<br/>
<div id = "editableText" Contentedable = "True"> </div>
</fieldset>
<script type = "text/javaScript">
Función SetFontColor (OBJ)
{
document.execCommand ("Forecolor", false, obj.value);
}
Función SetFontStyle (OBJ)
{
document.execCommand (obj.Value, falso, nulo);
}
función setFontfamily (OBJ)
{
document.execCommand ("fontname", false, obj.value);
}
</script>
</body>
</html> </span>
: : Http: //jsfiddle.net/web_code/npnv3/embedded/result/ 不足之处还请谅解 提出指正方法 提出指正方法