为什么这个HTML导致页面变成空白 [英] Why is this HTML causing the page to go blank

查看:120
本文介绍了为什么这个HTML导致页面变成空白的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jQuery来执行$ .get请求。

I'm using jQuery to do a $.get request.

$.get(url, {}, function (result) {
        $('#FactsheetTabs .tab_container div:visible').fadeOut(100, function () {
            $('#FactsheetTabs .tab_container')
            .html(result)
            .fadeIn(100);
});

响应对象包含(以及其他内容)以下HTML:

The response object contains (among other stuff) the following HTML:

<img 
    id="VB_2wCo_bvai" 
    name="VB_2wCo_bvai" 
    width="570" height="243" 
    style="border:0;" 
    usemap="#imVB_2wCo_bvai" 
    src="http://ie-sv-corda72:2001/?@_CPRVB_2wCo_bvai" /> 
    // this URL is to an image on one of our internal servers

问题在于Firefox或Chrome(我在Firebug的Net标签中可以看到),在 .html(结果)之后函数执行,浏览器启动一个全新的reqeust来获取图像..而这只是重新显示在浏览器中的空白页面中的sults,而不是带有图像的屏幕上的新HTML呈现。

The problem is that with Firefox or Chrome (as I can see in Firebug's Net tab), after the .html(result) function executes, the browser starts a brand new reqeust to get the image.. and this just results in a blank page showing up in the browser, rather than the new HTML rendering on the screen with the image.

有没有人见过这样的问题?知道如何解决这个问题吗?

Has anyone seen an issue like this before? Any idea how to resolve this?

编辑:完整的回复代码如下:

The complete response code is as follows:

<script type="text/javascript">
    var put1006635006Props;
    var put1747344981Props;
    var put518384227Props;

    function getImageMap208345221() {
        put1006635006Props = new PopUpProperties;
        put1006635006Props.width = 400;
        put1006635006Props.textColor = "#000000";
        put1006635006Props.textSize = "12.0";
        put1006635006Props.textFont = "Helvetica";
        put1006635006Props.fillColor = "#ffffe1";
        put1006635006Props.borderColor = "#000000";
        put1006635006Props.hpos = LEFT;
        put1006635006Props.vpos = ABOVE;
        put1006635006Props.justification = "LEFT";
        put1747344981Props = new PopUpProperties;
        put1747344981Props.width = 400;
        put1747344981Props.textColor = "#000000";
        put1747344981Props.textSize = "12.0";
        put1747344981Props.textFont = "Helvetica";
        put1747344981Props.fillColor = "#ffffe1";
        put1747344981Props.borderColor = "#000000";
        put1747344981Props.hpos = CENTER;
        put1747344981Props.vpos = ABOVE;
        put1747344981Props.justification = "LEFT";
        put518384227Props = new PopUpProperties;
        put518384227Props.width = 400;
        put518384227Props.textColor = "#000000";
        put518384227Props.textSize = "12.0";
        put518384227Props.textFont = "Helvetica";
        put518384227Props.fillColor = "#ffffe1";
        put518384227Props.borderColor = "#000000";
        put518384227Props.hpos = RIGHT;
        put518384227Props.vpos = ABOVE;
        put518384227Props.justification = "LEFT";

        document.writeln('<map name="imVB_2wCo_bvai" id="imVB_2wCo_bvai"><area shape="poly" coords="540,52,547,52,547,59,540,59,540,52" onmouseover="return showPopUp ? showPopUp(put1006635006Props, \'VB_2wCo_bvai\', \'Schroder All Mats Idx Lnkd Bd I Acc 2.58%\', 543, 49) : false;"/><area shape="poly" coords="497,41,504,41,504,48,497,48,497,41" onmouseover="return showPopUp ? showPopUp(put1747344981Props, \'VB_2wCo_bvai\', \'Schroder All Mats Idx Lnkd Bd I Acc 3.27%\', 500, 38) : false;"/><area shape="poly" coords="454,49,461,49,461,56,454,56,454,49" onmouseover="return showPopUp ? showPopUp(put1747344981Props, \'VB_2wCo_bvai\', \'Schroder All Mats Idx Lnkd Bd I Acc 2.77%\', 457, 46) : false;"/><area shape="poly" coords="411,76,418,76,418,83,411,83,411,76" onmouseover="return showPopUp ? showPopUp(put1747344981Props, \'VB_2wCo_bvai\', \'Schroder All Mats Idx Lnkd Bd I Acc 1.14%\', 414, 73) : false;"/><area shape="poly" coords="368,98,375,98,375,105,368,105,368,98" onmouseover="return showPopUp ? showPopUp(put1747344981Props, \'VB_2wCo_bvai\', \'Schroder All Mats Idx Lnkd Bd I Acc -0.2%\', 371, 95) : false;"/><area shape="poly" coords="325,91,332,91,332,98,325,98,325,91" onmouseover="return showPopUp ? showPopUp(put1747344981Props, \'VB_2wCo_bvai\', \'Schroder All Mats Idx Lnkd Bd I Acc 0.25%\', 328, 88) : false;"/><area shape="poly" coords="281,108,288,108,288,115,281,115,281,108" onmouseover="return showPopUp ? showPopUp(put1747344981Props, \'VB_2wCo_bvai\', \'Schroder All Mats Idx Lnkd Bd I Acc -0.79%\', 284, 105) : false;"/><area shape="poly" coords="238,106,245,106,245,113,238,113,238,106" onmouseover="return showPopUp ? showPopUp(put1747344981Props, \'VB_2wCo_bvai\', \'Schroder All Mats Idx Lnkd Bd I Acc -0.69%\', 241, 103) : false;"/><area shape="poly" coords="195,120,202,120,202,127,195,127,195,120" onmouseover="return showPopUp ? showPopUp(put1747344981Props, \'VB_2wCo_bvai\', \'Schroder All Mats Idx Lnkd Bd I Acc -1.49%\', 198, 117) : false;"/><area shape="poly" coords="152,160,159,160,159,167,152,167,152,160" onmouseover="return showPopUp ? showPopUp(put1747344981Props, \'VB_2wCo_bvai\', \'Schroder All Mats Idx Lnkd Bd I Acc -3.96%\', 155, 157) : false;"/><area shape="poly" coords="109,97,116,97,116,104,109,104,109,97" onmouseover="return showPopUp ? showPopUp(put1747344981Props, \'VB_2wCo_bvai\', \'Schroder All Mats Idx Lnkd Bd I Acc -0.15%\', 112, 94) : false;"/><area shape="poly" coords="66,92,73,92,73,99,66,99,66,92" onmouseover="return showPopUp ? showPopUp(put1747344981Props, \'VB_2wCo_bvai\', \'Schroder All Mats Idx Lnkd Bd I Acc 0.2%\', 69, 89) : false;"/><area shape="poly" coords="23,95,30,95,30,102,23,102,23,95" onmouseover="return showPopUp ? showPopUp(put518384227Props, \'VB_2wCo_bvai\', \'Schroder All Mats Idx Lnkd Bd I Acc 0%\', 26, 92) : false;"/><area shape="rect" coords="0,0,570,570" onmouseover="return hidePopUp ? hidePopUp() : false;"/></map>');
    }
</script>
<script type="text/javascript">
    <!-- Check to see if the jsPopUp code is already included
    if(typeof jsPopUp == 'undefined') {
        document.writeln('<script type="text/javascript" src="http://ie-sv-corda72:2001/?jsPopUp"></scr'+'ipt>');
    }
    if(document.layers) getImageMap208345221();
    //-->
</script>
<img 
    id="VB_2wCo_bvai" 
    name="VB_2wCo_bvai" 
    width="570" height="243" 
    style="border:0;" 
    usemap="#imVB_2wCo_bvai" 
    src="http://ie-sv-corda72:2001/?@_CPRVB_2wCo_bvai" />
<script type="text/javascript">
    if (!document.layers) getImageMap208345221();
</script>
<noscript>
    <map name="imVB_2wCo_bvai" id="imVB_2wCo_bvai">
        <area shape="poly" coords="540,52,547,52,547,59,540,59,540,52" alt="Schroder All Mats Idx Lnkd Bd I Acc 2.58%" />
        <area shape="poly" coords="497,41,504,41,504,48,497,48,497,41" alt="Schroder All Mats Idx Lnkd Bd I Acc 3.27%" />
        <area shape="poly" coords="454,49,461,49,461,56,454,56,454,49" alt="Schroder All Mats Idx Lnkd Bd I Acc 2.77%" />
        <area shape="poly" coords="411,76,418,76,418,83,411,83,411,76" alt="Schroder All Mats Idx Lnkd Bd I Acc 1.14%" />
        <area shape="poly" coords="368,98,375,98,375,105,368,105,368,98" alt="Schroder All Mats Idx Lnkd Bd I Acc -0.2%" />
        <area shape="poly" coords="325,91,332,91,332,98,325,98,325,91" alt="Schroder All Mats Idx Lnkd Bd I Acc 0.25%" />
        <area shape="poly" coords="281,108,288,108,288,115,281,115,281,108" alt="Schroder All Mats Idx Lnkd Bd I Acc -0.79%" />
        <area shape="poly" coords="238,106,245,106,245,113,238,113,238,106" alt="Schroder All Mats Idx Lnkd Bd I Acc -0.69%" />
        <area shape="poly" coords="195,120,202,120,202,127,195,127,195,120" alt="Schroder All Mats Idx Lnkd Bd I Acc -1.49%" />
        <area shape="poly" coords="152,160,159,160,159,167,152,167,152,160" alt="Schroder All Mats Idx Lnkd Bd I Acc -3.96%" />
        <area shape="poly" coords="109,97,116,97,116,104,109,104,109,97" alt="Schroder All Mats Idx Lnkd Bd I Acc -0.15%" />
        <area shape="poly" coords="66,92,73,92,73,99,66,99,66,92" alt="Schroder All Mats Idx Lnkd Bd I Acc 0.2%" />
        <area shape="poly" coords="23,95,30,95,30,102,23,102,23,95" alt="Schroder All Mats Idx Lnkd Bd I Acc 0%" />
    </map>
</noscript>


推荐答案

在页面完全呈现后执行document.write这是一件坏事,因为它会在您执行此操作时创建新文档。因此,如果您的任何document.writeln在该脚本中执行,那么可能导致您的页面被清空。

Doing a document.write after the page has fully rendered is a bad thing since it will create a new document when you do this. So if any of your document.writeln get executed in that script then that is probably causing your page to be blanked.

这篇关于为什么这个HTML导致页面变成空白的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆