在线编HTML辑器(兼容IE和Firefox)
来源:互联网 发布:json date 格式化输出 编辑:程序博客网 时间:2024/05/01 06:51
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
#editor { height:200px; }
</style>
</head>
<body>
<p>
<script type="text/javascript">
document.writeln("<iframe name=/"editor/" id=/"editor/" width=/"100%/"></iframe>");
var editor;
editor = document.getElementById("editor").contentWindow;
//只需键入以下设定,iframe立刻变成编辑器。
editor.document.designMode = 'On';
editor.document.contentEditable = true;
//但是IE与FireFox有点不同,为了兼容FireFox,所以必须创建一个新的document。
editor.document.open();
editor.document.writeln('<html><body></body></html>');
editor.document.close();
//字体特效 - 加粗方法一
function addBold()
{
editor.focus();
//所有字体特效只是使用execComman()就能完成。
editor.document.execCommand("Bold", false, null);
}
function additalic()
{
editor.focus();
//所有字体特效只是使用execComman()就能完成。
editor.document.execCommand("italic", false, null);
}
</script>
<input type="button" name="Submit" value="粗体" onclick="addBold()" />
<input type="button" name="Submit1" value="斜体" onclick="additalic()" />
</p>
</body>
</html>
- 在线编HTML辑器(兼容IE和Firefox)
- 简单HTML在线编辑器实现原理(兼容IE和FireFox)(转)
- 在线编辑器实现原理(兼容IE和FireFox)
- 在线编辑器实现原理(兼容IE和FireFox)
- 兼容ie和firefox的获取html元素自定义属性
- [js] 兼容IE和firefox
- showModelessDialog兼容firefox和ie
- WeisEditor在线文本编辑器v2.1.1 (兼容ie,firefox)
- 兼容ie和firefox的表格删除
- 兼容ie和 firefox的event事件
- js网页日历,兼容IE和Firefox
- js 实现键盘记录 兼容FireFox和IE
- 兼容IE和firefox的日期控件
- js脚本:ie和firefox的兼容
- css兼容IE和FireFox(FF)
- 兼容IE和Firefox的event对象
- 兼容IE和Firefox的“加入收藏”代码
- js 实现键盘记录 兼容FireFox和IE
- SOA 快速指南 1 2 3
- SOA 快速指南 1 2 3
- algorithm 非修改性序列操作源码
- Microsoft VirtualPC 2007 已经发布
- 微软发布2月份安全更新补丁
- 在线编HTML辑器(兼容IE和Firefox)
- Foobar2000英文优化增强版 by TaoteSea --2006.12.25
- 基于WEB分布式信息系统的设计
- SQL 2000 Server 安装:以前的某个程序安装已在安装计算机上创建挂起的文件操作
- 用EasyBoot制作光盘启动菜单
- 企业网络安全对策
- 三维物体消隐算法
- VB新手入门之一
- 工程施工中应用多媒体技术