项目中用了个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去验证呗,呵呵. 貌似小题大作了一番,没办法;刚自己居然被一个非空验证
弄啥了,汗......