调用UEditor的图片上传组件进行图片上传,并解决多编辑器共存的取值问题
<script type="text/javascript" charset="utf-8" src="../ueditor/editor_config.js"></script>
<script type="text/javascript" charset="utf-8" src="../ueditor/editor_all.js"></script>
<dl>
<dt>图片标题:</dt>
<dd>
<asp:TextBox ID="txtTitlePic" runat="server" Width="400" ClientIDMode="Static"></asp:TextBox>
<input type="button" value="上传图片" onclick="uploadImage($('#txtTitlePic'))"/>
</dd>
</dl>
<script type="text/javascript">
var dlg;
var inputBox;
var imgEditor = new UE.ui.Editor();
imgEditor.render("imgEditor");
imgEditor.ready(function () {
imgEditor.setDisabled();
imgEditor.hide();
imgEditor.addListener('beforeInsertImage', function (t, args) {
inputBox.val(args[0].src);
});
});
function uploadImage(o) {
inputBox = $(o);
dlg = imgEditor.getDialog("insertimage");
dlg.render();
dlg.open();
}
</script>
多编辑器取值,使用Textarea做容器
<textarea id="txtContent" name="articleContent"><p></p></textarea>
后台Content = Server.HtmlEncode(Request["articleContent"])即可
暂无评论
发表评论