Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript innerHTML iframe标记的firefox错误_Javascript - Fatal编程技术网

Javascript innerHTML iframe标记的firefox错误

Javascript innerHTML iframe标记的firefox错误,javascript,Javascript,在没有下载完成之前,使用innerHTML将导致页面加载iframe无序 在下面的示例中,首先单击“openA”(谷歌页面),然后单击“openB”(雅虎页面),然后单击“openA”,然后在错误的雅虎页面上显示一个窗口 chrome和IE中的漏洞在下不存在 如何避免这个问题 错误示例代码: <HTML> <HEAD> <script> function openA(){ var winObj=document.getElementById("win_

在没有下载完成之前,使用innerHTML将导致页面加载iframe无序

在下面的示例中,首先单击“openA”(谷歌页面),然后单击“openB”(雅虎页面),然后单击“openA”,然后在错误的雅虎页面上显示一个窗口

chrome和IE中的漏洞在下不存在

如何避免这个问题

错误示例代码:

<HTML>
<HEAD>
<script>
function openA(){
    var winObj=document.getElementById("win_A");
    if(winObj==null){
        winObj=document.createElement('div');
        winObj.id="win_A";
        winObj.style.position="absolute";
        winObj.style.left="0";
        winObj.style.top="200";
        winObj.style.height="300";
        winObj.style.width="300";
        winObj.style.border="1px solid red";
        document.body.appendChild(winObj);
    }
    document.getElementById("win_A").innerHTML=("<iframe src='http://www.google.com/'></iframe>");
}
function openB(){
    var winObj=document.getElementById("win_B");
    if(winObj==null){
        winObj=document.createElement('div');
        winObj.id="win_B";
        winObj.style.position="absolute";
        winObj.style.left="350";
        winObj.style.top="200";
        winObj.style.height="300";
        winObj.style.width="300";
        winObj.style.border="1px solid red";
        document.body.appendChild(winObj);
    }
    document.getElementById("win_B").innerHTML=("<iframe src='http://www.yahoo.com/'></iframe>");
}
</script>
</HEAD>

<BODY>
    <INPUT TYPE="button" VALUE="openA" ONCLICK="openA()"><INPUT TYPE="button" VALUE="openB" ONCLICK="openB()">
    <script>document.write("<iframe src=\"http://www.chaozh.cn/Iheeo_pic/200961017195991087.bmp?"+new Date()+"\"></iframe>");</script>
    <INPUT TYPE="button" VALUE="Reload" ONCLICK="location.href=location.href;">
</BODY>
</HTML>

</pre>

函数openA(){
var winObj=document.getElementById(“win_A”);
if(winObj==null){
winObj=document.createElement('div');
winObj.id=“win_A”;
winObj.style.position=“绝对”;
winObj.style.left=“0”;
winObj.style.top=“200”;
winObj.style.height=“300”;
winObj.style.width=“300”;
winObj.style.border=“1px实心红色”;
document.body.appendChild(winObj);
}
document.getElementById(“win_A”).innerHTML=(“”);
}
函数openB(){
var winObj=document.getElementById(“win_B”);
if(winObj==null){
winObj=document.createElement('div');
winObj.id=“win_B”;
winObj.style.position=“绝对”;
winObj.style.left=“350”;
winObj.style.top=“200”;
winObj.style.height=“300”;
winObj.style.width=“300”;
winObj.style.border=“1px实心红色”;
document.body.appendChild(winObj);
}
document.getElementById(“win_B”).innerHTML=(“”);
}
文件。填写(“”);
在FF 3.5.3上对我很好

通过大量的点击成功地复制了它。 在我看来,这似乎是FireFox中的一个bug

与其每次都重新创建iframe,不如设置它的
.src

在FF 3.5.3上运行良好

通过大量的点击成功地复制了它。 在我看来,这似乎是FireFox中的一个bug


与其每次都重新创建iframe,不如只设置它的
.src

在IE中不需要使用大的bmp

在IE中不需要使用大的bmp

你在firefox下载的时候已经在点击“openA”和“openB”了吗?必须在“下载”出现时将“BUGtry replace”替换为一个大的BMP文件或页面。您在firefox中下载的时候已经在点击“openA”和“openB”了吗?当错误将“”替换为一个大的BMP文件或页面时,必须出现在“下载”中。恐怕你的问题没有什么意义。你说的“框架障碍”是什么意思?此外,我看不到任何人使用该代码并进行实验,只要其中有指向某个未知站点的链接。人们是可以理解的…谨慎。你可以尝试替换“chaozh.cn/Iheeo_pic/200961017195991087.bmp/…;到一个大的BMP文件或页面。恐怕你的问题没有什么意义。你说的“框架障碍”是什么意思?此外,我看不到任何人使用该代码并进行实验,只要其中有指向某个未知站点的链接。人们是可以理解的…谨慎。你可以尝试替换“chaozh.cn/Iheeo_pic/200961017195991087.bmp/…;到一个大的BMP文件或页面