Javascript child.onload在IE8中未被调用,但在Firefox和Chrome中工作

Javascript child.onload在IE8中未被调用,但在Firefox和Chrome中工作,javascript,internet-explorer-8,onload,Javascript,Internet Explorer 8,Onload,当我单击超链接时,在IE8中不会调用child.onload函数。我不知道为什么,但是可以在其他浏览器中使用。 也没有语法错误。这段代码是我从html文件粘贴的 另外,如果我使用setTimeout 5秒等来分配子表单字段,那么它在IE8中工作 JavaScript: <script type="text/javascript"> function openWindow(){ var child=window.open("index.php?option=com_aicont

当我单击超链接时,在IE8中不会调用child.onload函数。我不知道为什么,但是可以在其他浏览器中使用。 也没有语法错误。这段代码是我从html文件粘贴的

另外,如果我使用setTimeout 5秒等来分配子表单字段,那么它在IE8中工作

JavaScript:

<script type="text/javascript">
function openWindow(){
    var child=window.open("index.php?option=com_aicontactsafe&pf=4&tmpl=component",'win2','width=400,height=350,menubar=yes,resizable=yes');

    if(child!==null) {
        child.onload=function() { 
            alert("In onload");
            child.document.getElementById("aics_ForDocument_Title").value=window.document.getElementById("documentname").innerHTML; 
            child.document.getElementById("aics_FormURL").value="$referer"; 
            child.document.getElementById("aics_FormURL").readOnly=true;
            };
        }
    return false;
}
</script>
<div id="reportthis">
    <a href="#"  onclick=" openWindow();">
        <img src="images/instruments/reportthis.jpg" width="110" height="31" alt="Report This" title="Report this document for any issues" />
    </a>
</div>

函数openWindow(){
var child=window.open(“index.php?option=com_aicontactsafe&pf=4&tmpl=component”,“win2”,“width=400,height=350,menubar=yes,resizeable=yes”);
如果(子项!==null){
child.onload=function(){
警报(“加载中”);
child.document.getElementById(“aics_for document_Title”).value=window.document.getElementById(“documentname”).innerHTML;
child.document.getElementById(“aics_FormURL”).value=“$referer”;
child.document.getElementById(“aics_FormURL”).readOnly=true;
};
}
返回false;
}
HTML:

<script type="text/javascript">
function openWindow(){
    var child=window.open("index.php?option=com_aicontactsafe&pf=4&tmpl=component",'win2','width=400,height=350,menubar=yes,resizable=yes');

    if(child!==null) {
        child.onload=function() { 
            alert("In onload");
            child.document.getElementById("aics_ForDocument_Title").value=window.document.getElementById("documentname").innerHTML; 
            child.document.getElementById("aics_FormURL").value="$referer"; 
            child.document.getElementById("aics_FormURL").readOnly=true;
            };
        }
    return false;
}
</script>
<div id="reportthis">
    <a href="#"  onclick=" openWindow();">
        <img src="images/instruments/reportthis.jpg" width="110" height="31" alt="Report This" title="Report this document for any issues" />
    </a>
</div>


可能是在分配处理程序之前触发加载事件。可能是在分配处理程序之前触发加载事件。