简单迷你文本编辑啊器
来源:互联网 发布:淘宝哪家婴儿衣服好 编辑:程序博客网 时间:2024/05/04 21:32
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>无标题页</title>
</head>
<body>
<!--作为编辑区的iframe-->
<iframe style="width: 100%; height:100" marginwidth="0" marginheight="0" frameborder="1" id="MsgFrame" src="about:blank"></iframe>
<br />
<input type="button" onclick="t('UnderLine')" value="下划线" />
<input type="button" onclick="t('bold')" value="粗体" id="Button1" />
<input type="button" onclick="t('JustifyLeft')" value="左对齐" />
<input type="button" onclick="t('JustifyCenter')" value="居中对齐" />
<input type="button" onclick="t('JustifyRight')" value="右对齐" />
<input type="button" onclick="t2()" value="增高" />
<input type="button" onclick="t3()" value="减少" />
<input type="button" onclick="ViewSource()" value="查看源代码" />
<script type="text/javascript" language="javascript">
//使iframe进入编辑状态。
var editor;
editor = document.getElementById("MsgFrame").contentWindow;
//window.frames["MsgFrame"].document.designMod
editor.document.open();
editor.document.writeln('<html><head>');
editor.document.writeln("</head><body></body></html>");
editor.document.onclick = "alert()";
editor.document.close();
editor.document.designMode = 'On';
editor.document.contentEditable = true;
editor.document.charset="gb2312";
function t(s)
{
editor.document.execCommand(s,false,null);
}
//增高
function t2(){
var obj=window.frames["MsgFrame"].frameElement;
var height = parseInt(obj.offsetHeight);//获取iframe的高度
if (height+100 >= 100){
obj.height = height+100;
}
}
//减低
function t3(){
var obj=window.frames["MsgFrame"].frameElement;
var height = parseInt(obj.offsetHeight);
if (height-100 >= 100){
obj.height = height-100;
}
}
function ViewSource(){
document.getElementById("textarea1").value = document.getElementById("MsgFrame").contentWindow.document.body.innerHTML;
}
</script>
<br/>
</body>
</html>
- 简单迷你文本编辑啊器
- 简单的文本编辑程序
- wxpython 简单文本编辑
- 关于文本编辑的简单实现
- 文本编辑距离计算,简单清晰
- 文本编辑
- 迷你播放器--综述
- 迷你图书器
- JAVA文本编辑(编译)器
- 迷你日期查询器MiniDate
- Java迷你Mp3播放器
- C# 简单文本编辑的撤销恢复功能实现
- 带你实现一个简单的MyApacheTomcat,迷你并发服务器
- AvalonJs入门 简单易用迷你的MVVM框架
- JavaScript 编写的迷你 Lisp 解释器
- android的MediaPlayer播放器迷你案例
- JavaScript 编写的迷你 Lisp 解释器
- 迷你音乐播放器(一)
- 转帖-网站排名算法解密
- valgrind 使用 (linux程序内存检测)
- 开博纪念
- Struts2文件的上传
- 思科网络安全解决方案
- 简单迷你文本编辑啊器
- Struts2.1之Jfreechart
- 在J2ME手机编程中使用字体
- WEB三层架构与MVC
- 自己用Class.rar
- 2010年5月各大城市招聘会信息/北京招聘会
- 三个月的总结
- Android核心分析(17) ------电话系统之rilD
- 在J2ME联网应用中获得客户端的手机号码