Ueditor官方网址:http://ueditor.baidu.com 。
Ueditor的使用参考步骤:
(1) 复制Ueditor相关东东至项目中
在这里我们在项目的js目录下新建ueditor目录,然后在ueditor官方包中copy相应文件至此目录下,最终结果如下:
(2) 页面内容如下
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" pageEncoding="UTF-8"%>
<%String path = request.getContextPath();%>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8"/>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>初探ueditor</title>
<script type="text/javascript" src="<%=path%>/js/ueditor/editor_config.js"></script>
<script type="text/javascript" src="<%=path%>/js/ueditor/editor_ui_all.js"></script>
<link rel="stylesheet" type="text/css" href="<%=path%>/js/ueditor/ueditor.css"/>
<style type="text/css">
#editor {width: 843px;}
/* for IE6 fixed */
body {background: url('about:blank') fixed;}
</style>
</head>
<body>
<script type="text/javascript">
var editor = new baidu.editor.ui.Editor({
id: 'editor',
initialContent: '欢迎使用<a href="http://ueditor.baidu.com/">UEditor</a>!',
initialStyle :'.selectTdClass{background-color:#3399FF !important}',
minFrameHeight: 120
});
editor.render('editor');
function v(){
document.getElementById('dd').value=document.getElementsByName('editor')[0].innerHTML;
alert(editor.getContent());
}
</script>
<input type="button" value="cccc" οnclick="v();"/><br/>
</body>
</html>
(3) 运行结果如下
后记:
1. ueditor获取值的方法是:editor.getContent() ;
2. ueditor刚推出的一个东东,还不是太成熟,期待下一版本有更大惊喜。