不行,报window.all.idEditbox
不是对象或者为空

解决方案 »

  1.   

    focus()这个方法是不是不对啊?
      

  2.   

    如果是input用window.all.idEditbox
    如果是iframe用原来的方法没问题
      

  3.   

    是iframe啊现在问题是iframe的焦点设置没效果var win=window.content_html.idEditbox.document;
      //下面这个焦点定位得不对!可是找不到解决办法
      window.content_html.idEditbox.focus();
      win.selection.createRange().pasteHTML(htmlCode)但取得的值却出现在在线编辑器的上面去了,而不是应该出现的框中
      

  4.   

    用object也不行,内容得不到显示<html>
    <script language="javascript">
    function CheckForm()
    {
    document.form1.content.value=document.form1.doc_html.value;
    }
    </script>
     <body onload="document.all.doc_html.value=document.all.content.value">
     <form method="post" action="add_news_save.asp"  onsubmit="CheckForm()" name="form1">
        <object id="doc_html" name="doc_html" style="LEFT: 0px; TOP: 0px" data="edit.htm" width=530 height=320 type=text/x-scriptlet  VIEWASTEXT></object>
      <TEXTAREA style="display:none" NAME="content" ROWS="20" COLS="70">gfdasjgidaogf<a href="">dfsafds测试</a></TEXTAREA>,
     </form>
     </body>
     </html>http://www.csdn.net/develop/Read_Article.asp?Id=15214这篇文章介绍的编辑是不是有问题?
      

  5.   

    请将edit.htm的主要代码贴出来用scriptlet需要公开访问权限,如
    public_description=new Editorfunction Editor()
    {
      this.put_html=function(v){target.document.body.innerHTML=v};
      this.get_html=function(){return target.document.body.innerHTML};
      this.put_text=function(v){target.document.body.innerText=v};
      this.get_text=function(){return target.document.body.innerText};
      this.get_doc=function(){return target.document};
    }
      

  6.   

    edit.htm很短,
    但是在线编辑器的js很大下载地址
    http://www.linxo.net/club/topic.cgi?forum=13&topic=9我需要的是编辑,也就是从服务器取得值后显示给页面
    这一部分请使用我上面的测试代码
      

  7.   

    http://www.csdn.net/develop/Read_Article.asp?Id=15214中的这个人呢
      

  8.   

    测试数据edit.htm
    <iframe id=idEditbox></iframe>
    <script>idEditbox.document.designMode="on";</script>
      

  9.   

    iframe版
    <html>
    <script>
    function insertHtml(htmlCode)
    {  var win=window.content_html.idEditbox.document;
      window.content_html.idEditbox.focus();
      win.selection.createRange().pasteHTML(htmlCode)}
    </script>
    <body >
     <IFRAME SRC=edit.htm id=content_html  width=100% height=400></IFRAME>
     <textarea style=display:none name=CCONTENT rows=10  cols=70>hsh<b>jgjkh</b>gkjghhf</textarea>
     <IMG style=display:none onload="javascript:insertHtml(document.all.CCONTENT.value)" src="http://www.csdn.net/csdn.gif"></body>
    </html> 
      

  10.   

    测试数据edit.html
    <iframe id=idEditbox></iframe>
    <script>
    idEditbox.document.designMode="on";public_description=new Editorfunction Editor()
    {
      this.insertHTML=function(htmlCode){
       idEditbox.focus();
       idEditbox.document.selection.createRange().pasteHTML(htmlCode)
    };
    }</script>scriptlet版
    <html>
    <script>
    function insertHtml(htmlCode)
    {window.content_html.insertHTML(htmlCode)
    }
    </script>
    <body >
      <object id="content_html" name="doc_html" style="LEFT: 0px; TOP: 0px" data="edit.htm" width=530 height=320 type=text/x-scriptlet  VIEWASTEXT></object> <textarea style=display:none name=CCONTENT rows=10  cols=70>hsh<b>jgjkh</b>gkjghhf</textarea>
     <IMG style=display:none onload="javascript:insertHtml(document.all.CCONTENT.value)" src="http://www.csdn.net/csdn.gif"></body>
    </html> 
      

  11.   

    你的两个代码也没成功,焦点依然不对,跑到iframe的上面去显示了你的iframe的代码和我的没区别啊!
    object还报错。
      

  12.   

    我的
    object没提示错误,但是不显示内容<html>
    <body onload="document.all.doc_html.value=document.all.content.value">
    <object id="doc_html" name="doc_html" style="LEFT: 0px; TOP: 0px" data="edit.htm" width=530 height=320 type=text/x-scriptlet  VIEWASTEXT></object>
    <TEXTAREA style="display:none" NAME="content" ROWS="20" COLS="70">测试1<a href="">测试2</a></TEXTAREA>
    </body>
    </html>
      

  13.   

    我的iframe版<html>
    <script >
    function insertHtml(htmlCode)
    {
       var win=window.content_html.idEditbox.document;
       window.content_html.idEditbox.focus();
       win.selection.createRange().pasteHTML(htmlCode)
    }
    </script>
    <BODY onload="insertHtml(document.all.CCONTENT.value)">
    <IFRAME SRC=edit.htm id=content_html width="50%" height="50%"></IFRAME>
    <TEXTAREA style="display:none" NAME="CCONTENT">测试1<a href="">测试2</a></TEXTAREA>
    </body>
    </html>