項目中用了個FCK 文本編輯框
看起來簡潔,用起來也還不錯.
Java代碼
- <script src="js/formValidator.js" type="text/javascript" charset="UTF-8"></script>
- <script src="js/fckeditor.js" type="text/javascript" charset="UTF-8"></script>
- <textarea rows="20" name="article.content" class="input_text" id="article_content" style="width:600px;" ></textarea>
- <!--<fck:editor instanceName="article.content"
- height="400px" width="600px"></fck:editor>-->
- <script type="text/javascript">
- var oFCKeditor = new FCKeditor('article_content') ;
- oFCKeditor.BasePath = "fckeditor/" ;
- oFCKeditor.Height = 200;
- oFCKeditor.ToolbarSet = "My" ;
- oFCKeditor.EnterMode = "" ;
- oFCKeditor.ShiftEnterMode = "br" ;
- oFCKeditor.ReplaceTextarea();
- </script>
<script src="js/formValidator.js" type="text/javascript" charset="UTF-8"></script>
<script src="js/fckeditor.js" type="text/javascript" charset="UTF-8"></script>
<textarea rows="20" name="article.content" class="input_text" id="article_content" style="width:600px;" ></textarea>
<!--<fck:editor instanceName="article.content"
height="400px" width="600px"></fck:editor>-->
<script type="text/javascript">
var oFCKeditor = new FCKeditor('article_content') ;
oFCKeditor.BasePath = "fckeditor/" ;
oFCKeditor.Height = 200;
oFCKeditor.ToolbarSet = "My" ;
oFCKeditor.EnterMode = "" ;
oFCKeditor.ShiftEnterMode = "br" ;
oFCKeditor.ReplaceTextarea();
</script>
做非空和長度限制驗證的時候 發現獲得的aiticle_content對象的value總是處于初始化狀态
不解.明明輸入了很多值;怎麼就不能驗證了 想了想是不是JQuery的問題 或者浏覽器的問題
寫了個 document.getElementById("article_content").value;
居然也沒值,汗..
弄了半天才想起來,呗FCK托管了嘛,當然是找FCK取值咯.
原來要這麼取值,汗.
Java代碼
- var content = FCKeditorAPI.GetInstance("article_content").GetXHTML(true);
var content = FCKeditorAPI.GetInstance("article_content").GetXHTML(true);
ok 拿着content去驗證呗,呵呵. 貌似小題大作了一番,沒辦法;剛自己居然被一個非空驗證
弄啥了,汗......