今天遇到1個比較奇異的問題,有1項目需要在同1個頁面上展現兩個ueditor編輯器,在展現時其實不任何問題,但當點擊了“保存”按鈕時就出錯了,有其中1個ueditor在asp.net中沒法獲得編輯器的值,這時候代碼是這樣的:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
//第1個ueditor
<script type= "text/plain"
id= "editorValue" ><asp:Literal ID= "ltlContent"
runat= "server" ></asp:Literal> </script> //第2個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"] 去獲得內容,但第1個ueditor卻是正常的,為何?代碼是1樣的,只是名字不1樣而已難道是一樣的出身竟有不同的命運?
~~~~~
我嘗試著改改id的名字問題仍然是沒法獲得編輯器的內容,最后我在第2個編輯器ueditor中加入1個屬性這問題居然就解決了。:(
方式就是:
在第2個百度編輯器增加name屬性
終究代碼:
1
2
3
4
5
6
7
|
//第1個沒有name屬性的 <script type= "text/plain"
id= "editorValue" ><asp:Literal ID= "ltlContent"
runat= "server" ></asp:Literal> </script> //第2個有name屬性的ueditor <script type= "text/plain"
id= "editorContact"
name= "editorContact" ><asp:Literal ID= "ltlContact"
runat= "server" ></asp:Literal> </script> |
居然在代碼世界里也有這樣的不公待遇,真是1頭霧水啊~~~
----------------
原文鏈接:http://www.cnblogs.com/samlin/p/editor_without_name_attribute.html
@小小推行--->
同時您也能夠查看做者最近的項目 8爪魚招標網 大家多給意見哦 :)