有用过百度ueditor编辑器的帮忙看下正常编辑器
在一个页面有2个编辑器,有时要显示一个编辑器,另一个隐藏,在.aspx页面判断,不符合要求不显示<%if (Request.QueryString["type"] == "sel")
              {%>
             <tr>
                <td class="left_title_2" style="width: 300px">
                    编辑器:
                </td>
                <td align="left" class="xq">
                    <script type="text/plain" id="Script1" name="contentRe"><%=sContentRe %></script>
                </td>
            </tr>
            <%} %>编辑器是隐藏了,但是在网页左面,出现一排编辑器的图标
求解决方法,怎么隐藏编辑器

解决方案 »

  1.   

    这个问题我刚好弄过,那是因为你在下面实例化一个编辑器比如:
    var editor = new baidu.editor.ui.Editor();
    editor.render('编辑器 id');这样的话,你要做一个判断才行,可以用jquery根据获取元素的length来判断就可以了
      

  2.   

    怎样用jquery根据获取元素的length来判断,判断之后又怎么做
      

  3.   

    你代码里做了判断,但是你在js中实例化一个editor的时候也要做相应判断,jquery判断的话,比如你要实例化的这个 <script type="text/plain" id="Script1" name="contentRe"><%=sContentRe %></script> id="Script1",哪里就这样写:
    $(function(){
    if($("#Script1").length>0){
    var editor = new baidu.editor.ui.Editor();
     editor.render('Script1);
    }
    });
    这样就可以了
      

  4.   

    把整个编辑器外层套个大的div 来判断条件隐藏该div
      

  5.   

    function LoadEditor() {
                var CMD = '<%=CMD %>';
                if (CMD == "New" || CMD == "Edit") {
                    var h = document.getElementById("<%=S_ShortRe.ClientID%>").clientWidth + 50;
                    //编辑器 Cai Add 2013
                    UE.getEditor('<%=txtS_Re.ClientID%>',{
                        //这里可以选择自己需要的工具按钮名称,此处仅选择如下五个
                        toolbars:[
                            ['fullscreen', 'source', '|', 'undo', 'redo', '|',
                                'bold', 'italic', 'underline', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch','autotypeset','blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist','selectall', 'cleardoc', '|',
                                'rowspacingtop', 'rowspacingbottom','lineheight','|',
                                'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
                                'directionalityltr', 'directionalityrtl', 'indent', '|',
                                'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|','touppercase','tolowercase','|',
                                'link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright','imagecenter', '|',
                                'insertimage', 'insertvideo','music','attachment','pagebreak','template', '|',
                                'horizontal', 'spechars', '|',
                                'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', '|',
                                'print', 'preview', 'searchreplace','help']
                        ],
                        //focus时自动清空初始化时的内容
                        autoClearinitialContent:false,
                        //关闭字数统计
                        wordCount:false,
                        //关闭elementPath
                        elementPathEnabled:false,
                        //更多其他参数,请参考editor_config.js中的配置项
                        initialFrameWidth: h,
                        initialFrameHeight: 300,
                        initialContent: '',
                        autoFloatEnabled:false,
                        //纵向滚动条
                        autoHeightEnabled:false
                    });
                }
            }设一个变量标识,判断一下就可以了。
    百度开源免费编辑器(UEditor)使用方法