为什么这个HTML导致页面变成空白

时间:2010-11-18 16:27:39

标签: jquery html asp.net-mvc image

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

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

响应对象包含以下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(result)功能后,浏览器会启动一个全新的请求以获取图像..这只会导致显示在浏览器中的空白页面,而不是带有图像的屏幕上的新HTML呈现。

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

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

<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>

1 个答案:

答案 0 :(得分:1)

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