复制代码代码如下:
<span style = "font-size: 14px ؛"> <! doctype html public "-// w3c // dtd xhtml 1.0 transitional // en"
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv = "content-type" content = "text/html ؛ charset = utf-8">
<title> 富文本编辑器 </title>
</head>
<body>
<fieldset>
<legend> 编辑区 </legend>
<viv>
<Porm>
: :
<حدد OnChange = "setFontColor (this)">
<Option Value = "Black"> Black </Option>
<Option Value = "RED"> Red </Option>
<Option Value = "Green"> Green </Option>
<Option Value = "Blue"> Blue </Option>
</select>
: :
<حدد OnChange = "setFontStyle (this)">
<Option Value = "Bold"> Bold </soph>
<Option Value = "Italic"> Italic </soph>
<Option Value = "Underline"> Underline </soph>
<Option Value = "StriketThrough"> StriketThrough </Option>
</select>
: :
<حدد OnChange = "setFontfamily (this)">
<Option Value = "serif"> serif </soph>
<Option Value = "sans-serif"> sans-serif </soph>
<value Option = "monospace"> monospace </soph>
<Option Value = "Comic Sans MS"> Comic Sans </portic>
</select>
</form>
</div>
<br/>
<div id = "editableText" contentIble = "true"> </viv>
</fieldset>
<script type = "text/javaScript">
وظيفة setFontColor (OBJ)
{
document.execcommand ("prepressolor" ، false ، obj.value) ؛
}
وظيفة setFontStyle (OBJ)
{
document.execcommand (Obj.value ، false ، null) ؛
}
وظيفة setFontfamily (OBJ)
{
document.execcommand ("fontname" ، false ، obj.value) ؛
}
</script>
</body>
</html> </span>
: http: //jsfiddle.net/web_code/npnv3/embedded/result/ 不足之处还请谅解 提出指正方法 提出指正方法