您的位置:首页 > 产品设计 > UI/UE

一个页面实例化两个ueditor编辑器,同样的出生却有不同的命运

2016-06-27 17:05 477 查看
今天遇到一个比较怪异的问题,有一项目需要在同一个页面上展现两个ueditor编辑器,在展现时并不任何问题,但当点击了“保存”按钮时就出错了,有其中一个ueditor在asp.net中无法获取编辑器的值,这时代码是这样的:

//第一个ueditor
<script type="text/plain" id="editorValue"><asp:Literal ID="ltlContent" runat="server"></asp:Literal>
</script>

//第二个ueditor
<script type="text/plain" id="editorContact" ><asp:Literal ID="ltlContact" runat="server"></asp:Literal>
</script>

//实例化
<script type="text/javascript">
var ue = new UE.ui.Editor({} );
var ueContact = new UE.ui.Editor({} );
ue.render( 'editorValue' );
ueContact.render( 'editorContact' );
</script>


结果就是editorContact这个编辑器的内容无法通过Request.Params["editorContact"] 去获取内容,但第一个ueditor却是正常的,为什么?代码是一样的,只是名字不一样而已难道是同样的出身竟有不同的命运?

~~~~~

我尝试着改改id的名字问题依然是无法获取编辑器的内容,最后我在第二个编辑器ueditor中加入一个属性这问题竟然就解决了。:(

方式就是:

在第二个百度编辑器增加name属性

最终代码:

//第一个没有name属性的
<script type="text/plain" id="editorValue"><asp:Literal ID="ltlContent" runat="server"></asp:Literal>
</script>

//第二个有name属性的ueditor
<script type="text/plain" id="editorContact" name="editorContact"><asp:Literal ID="ltlContact" runat="server"></asp:Literal>
</script>


竟然在代码世界里也有这样的不公待遇,真是一头雾水啊~~~

----------------

原文链接:http://www.cnblogs.com/samlin/p/editor_without_name_attribute.html

@小小推广--->

同时您也可以查看作者最近的项目 八爪鱼招标网 大家多给意见哦 :)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: