<div class="codetitle"> <span><a style="CURSOR: pointer" data="90363" class="copybut" id="copybut90363" onclick="doCopy('code90363')"><u>复代码</u></a></span> 代码如下:</div> <div class="codebody" id="code90363"> <br><span style="font-size:14px;"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <br><html xmlns="http://www.w3.org/1999/xhtml"> <br><머리> <br><meta http-equiv="content-type" content="text/html;charset=utf-8"> <br><title>富文本编辑器</title> <br></head> <br><본문> <br><필드세트> <br><legend>编辑区</legend> <br><div> <br><양식> <br>字体颜color: <br><select onchange="setFontColor(this)"> <br><option value="black">검정색 </option> <br><option value="red">빨간색 </option> <br><option value="green">녹색 </option> <br><option value="blue">파란색 </option> <br></select> <br>字体样式: <br><select onchange="setFontStyle(this)"> <br><option value="bold">굵게 </option> <br><option value="italic">기울임꼴 </option> <br><option value="underline">밑줄 </option> <br><option value="striketthrough">StriketThrough </option> <br></select> <br>자체 이름: <br><select onchange="setFontFamily(this)"> <br><option value="serif">세리프 </option> <br><option value="sans-serif">Sans-serif </option> <br><option value="monospace">고정폭 </option> <br><option value="comic sans ms">Comic Sans </option> <br></select> <br></form> <br></div> <br><br/> <br><div id="editableText" contenteditable="true" style="width:400px;min-height:100px;border:2px dashed #ccc"></div> <br></fieldset> <br><script type="text/javascript"> <br>function setFontColor(obj) <br>{ <br>document.execCommand("forecolor",false,obj.value); <br>} <br>function setFontStyle(obj) <br>{ <br>document.execCommand(obj.value,false,null); <br>} <br>function setFontFamily(obj) <br>{ <br>document.execCommand("fontname",false,obj.value); <br>} <br></script> <br></body> <br></html></span> <br> </div> <br>현재线演示:http://jsfiddle.net/Web_Code/nPNv3/embedded/result/ 不足之处还请谅解,提流指正方法