网页编辑器是嵌入了一个textarea和一个iframe:
<textarea name="content" style="display:none"><%=HtmlEditContent%></textarea><input type="hidden" name="content1">
<iframe ID="eWebEditor1" srcewebeditor.asp?id=content&style=standard" frameborder="0" scrolling="no" width="100%" HEIGHT="100%">在网页编辑器中有下面一段代码,是打开一个模态窗口img.htm的代码:
sMenu += getMenuRow("", "ShowDialog('img.htm', 650, 815, true)", "img.gif", "插入或修改图片");现在,在img.html中上传了一个图片得到了图片路径,如何将此图片插入到编辑器中的textarea呢?
<textarea name="content" style="display:none"><%=HtmlEditContent%></textarea><input type="hidden" name="content1">
appendChild和insertAdjacentHTML都试过,可是报错,returnValue也不知行不行,求高手指点迷津。谢谢。

解决方案 »

  1.   

    function setValue(){
      window.returnValue ="要获取的值"; //在模态窗体关闭前给window.returnValue赋值
      window.close();
    }
    function getValue(){
    //接受window.returnValue
    var returnValue=window.showModalDialog("enterpriseLngLat.jsp","","dialogHeight: "+iHeight+"px;dialogWidth: "+iWidth+"px;dialogTop: "+iTop+"; dialogLeft: "+iLeft+"; resizable: no; status: no;scroll:no")
    }
      

  2.   

    在img.html中上传了一个图片得到了图片路径,如何将此图片插入到编辑器中的textarea呢?
      

  3.   

    找到了方法。但发现window.showModalDialog是可以的:function getValue(){
    var returnValue=window.showModalDialog("dialog.html")
    var oo=returnValue;
    var img = new Image()
        img.src = oo;
    document.getElementById("content").appendChild(img)
    }但是改成showDialog却提示“对象不支持此属性或方法”。可是原程序中是
    case "component": // 组件菜单
          sMenu += getMenuRow("", "ShowDialog('dialog/img.htm', 650, 815, true)", "img.gif", "插入或修改图片");这怎么处理啊?