日期:2014-05-16  浏览次数:20338 次

ShowDialog打开的子页,如何将子页的图片插入父页的文本域?
网页编辑器是嵌入了一个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也不知行不行,求高手指点迷津。谢谢。



------解决方案--------------------
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")
}