日期:2014-05-19  浏览次数:20745 次

WYSIWYG组件的实现原理
最近想做一个所见即所得的WEB控件,可是不知道从哪边下手.看了fceditor的代码太复杂,也没理出头绪.   首先想知道的是那个可编辑的框框是个什么控件实现的啊?

------解决方案--------------------
主要的原理就是在主窗体中插入一iframe并设置designMode为On然后再对选中文本进行操作

<!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>
</head>
<body>
<iframe src= " " name= "edit " id= "edit " frameborder= "1 " width= "500 " height= "300 "> </iframe>
<script language= "javascript ">
window.frames[ "edit "].document.designMode= "On ";
</script>
</body>
</html>