一个页面中使用多个UEditor

如何在一个页面中使用多个Ueditor:

引入这些js:

    <script src="~/Scripts/ueditor/ueditor.config.js"></script>
<script src="~/Scripts/ueditor/ueditor.all.min.js"></script>
<link href="~/Scripts/ueditor/themes/iframe.css" rel="stylesheet" />
<script src="~/Scripts/ueditor/lang/zh-cn/zh-cn.js"></script>

实例不同的UEditor:

<script type="text/javascript">
var editor = new baidu.editor.ui.Editor({
UEDITOR_HOME_URL: '/Scripts/ueditor/',//配置编辑器路径
iframeCssUrl: '/Scripts/ueditor/themes/iframe.css',//样式路径
initialContent: '',//初始化编辑器内容
autoHeightEnabled: true,//高度自动增长
minFrameHeight: 1000,//最小高度
autoClearinitialContent: false,//是否自动清除编辑器出事内容
autoFloatEnabled: true,
initialFrameWidth: 1000,
initialFrameHeight: 500,
toolbars: [
['source', 'undo', 'redo', 'bold', 'simpleupload', 'insertimage', 'preview', 'dialog', 'beijing']
]
});
editor.render('editor'); var editorTwo = new baidu.editor.ui.Editor({
UEDITOR_HOME_URL: '/Scripts/ueditor/',//配置编辑器路径
iframeCssUrl: '/Scripts/ueditor/themes/iframe.css',//样式路径
initialContent: '',//初始化编辑器内容
autoHeightEnabled: true,//高度自动增长
minFrameHeight: 1000,//最小高度
autoClearinitialContent: false,//是否自动清除编辑器出事内容
autoFloatEnabled: true,
initialFrameWidth: 1000,
initialFrameHeight: 500,
toolbars: [
['source', 'undo', 'redo', 'bold', 'simpleupload', 'insertimage', 'preview', 'dialog', 'beijing']
]
});
editorTwo.render('editorTwo'); var editorThree = new baidu.editor.ui.Editor({
UEDITOR_HOME_URL: '/Scripts/ueditor/',//配置编辑器路径
iframeCssUrl: '/Scripts/ueditor/themes/iframe.css',//样式路径
initialContent: '',//初始化编辑器内容
autoHeightEnabled: true,//高度自动增长
minFrameHeight: 1000,//最小高度
autoClearinitialContent: false,//是否自动清除编辑器出事内容
autoFloatEnabled: true,
initialFrameWidth: 1000,
initialFrameHeight: 500,
toolbars: [
['source', 'undo', 'redo', 'bold', 'simpleupload', 'insertimage', 'preview', 'dialog', 'beijing']
]
});
editorThree.render('editorThree'); var editorFour = new baidu.editor.ui.Editor({
UEDITOR_HOME_URL: '/Scripts/ueditor/',//配置编辑器路径
iframeCssUrl: '/Scripts/ueditor/themes/iframe.css',//样式路径
initialContent: '',//初始化编辑器内容
autoHeightEnabled: true,//高度自动增长
minFrameHeight: 1000,//最小高度
autoClearinitialContent: false,//是否自动清除编辑器出事内容
autoFloatEnabled: true,
initialFrameWidth: 1000,
initialFrameHeight: 500,
toolbars: [
['source', 'undo', 'redo', 'bold', 'simpleupload', 'insertimage', 'preview', 'dialog', 'beijing']
]
});
editorFour.render('editorFour'); function success(data) {
if (data == "ok") {
alert("添加成功");
//拼接添加成功后返回的路由
window.location.href = "/Subject/Index/?id=@ViewData["eid"]&bkid=@ViewData["bkid"]&csid=@ViewData["csid"]"; } else if (data == "error"){
alert("添加失败");
}
}
</script>

调用:

        <div>
<textarea id="editor" name="editor"></textarea>
</div>
<div>
<textarea id="editorTwo" name="editorTwo"></textarea>
</div>
<div>
<textarea id="editorThree" name="editorThree"></textarea>
</div>
<div>
<textarea id="editorFour" name="editorFour"></textarea>
</div>
上一篇:Mysql权限对照表


下一篇:201621123001 《java程序设计》第2周学习总结