`
cocoIT
  • 浏览: 48314 次
  • 性别: Icon_minigender_1
  • 来自: 福建
文章分类
社区版块
存档分类
最新评论

所见即所得编辑器(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>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics