所见即所得编辑器(js版)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
       <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
       <title>Untitled Document</title>
       <script type="text/javascript">
         function init()
         {
            var contentObj = document.getElementById("content"); 
            
            //取得 iframe 内的窗口对象。firefox 可以直接用 contentObj.document;
            var contentDocObj = contentObj.contentWindow.document;
            
            contentDocObj.designMode = "on";
         }
         
         function makeBlob()
         {
            var contentDocObj = document.getElementById("content").contentWindow.document;
            
            contentDocObj.execCommand("Bold",false,null);
         }
         
         function makeItalic()
         {
            var contentDocObj = document.getElementById("content").contentWindow.document;
            
            contentDocObj.execCommand("Italic",false,null);             
         }
         
         function changeColor()
         {
            var contentDocObj = document.getElementById("content").contentWindow.document;
            
            contentDocObj.execCommand('ForeColor',false,'#BBDDCC');          
         }
       </script>
</head>
<body _disibledevent=>        <p><button _disibledevent=>        <button _disibledevent=>        <button _disibledevent=>        </p>
       <iframe id="content" width="400px" height="200px" style="border:1px solid"></iframe>
</body>
</html>
阅读更多
文章标签: js
个人分类: javascript
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

不良信息举报

所见即所得编辑器(js版)

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭