百度编辑器UEditor在html代码模式无法更新内容的解决方案
使用UEditor百度编辑器会发现一个棘手的问题,就是切换到html源代码模式编辑内容时,无法保存更新的内容,可以通过以下办法解决。
<script type="text/plain" id="content" name="content"><%=rs("content")%></script> <script type="text/javascript">UE.getEditor("content")</script> <script type="text/javascript"> function getContent() { if(UE.getEditor("content").queryCommandState('source')!=0) UE.getEditor("content").execCommand('source'); } </script> <input name="Submit" type="submit" value="修 改" OnClick="getContent()">
主要是是增加了代码
<script type="text/javascript"> function getContent() { if(UE.getEditor("content").queryCommandState('source')!=0) UE.getEditor("content").execCommand('source'); } </script>
提交按钮增加代码
OnClick="getContent()"