Javascript CSS效果仅在IE8中调整窗口大小后出现

Javascript CSS效果仅在IE8中调整窗口大小后出现,javascript,internet-explorer-8,css3pie,Javascript,Internet Explorer 8,Css3pie,我正在编写一个基本网站,并使用CSS3PIE在IE8中启用圆角和渐变效果。我的问题是当我使用javascript导入部分代码(导航栏)时。如果我在IE8中加载页面,效果不会显示。只有当我调整页面大小时,效果才会出现。如果代码在文档中内联,则不会发生这种情况 这是我的导航条形码: <table class="Nav_Bar"> <tr> <td class="Nav_Bar_L1"> Heading 1</t

我正在编写一个基本网站,并使用CSS3PIE在IE8中启用圆角和渐变效果。我的问题是当我使用javascript导入部分代码(导航栏)时。如果我在IE8中加载页面,效果不会显示。只有当我调整页面大小时,效果才会出现。如果代码在文档中内联,则不会发生这种情况

这是我的导航条形码:

    <table class="Nav_Bar">
    <tr>
        <td class="Nav_Bar_L1">
        Heading 1</td>

    <tr>
        <td class="Nav_Bar_L2">
            SubHeading 1</td>

    <tr>
        <td class="Nav_Bar_L3">
            SubSubHeading 1</td>

    <tr>
        <td class="Nav_Bar_L1">
            Heading 2</td>

    <tr>
        <td class="Nav_Bar_L2">
            SubHeading 2</td>

    <tr>
        <td class="Nav_Bar_L3">
            SubSubHeading 2</td>

</table>
和我的IE特定CSS:

.Nav_Bar_L1 {
    border-radius: 5px;
    -pie-background: linear-gradient(#669900, #FFFFFF);
    behavior: url(PIE/PIE.htc);
}

.Nav_Bar_L2 {
    border-radius: 5px;
    -pie-background: linear-gradient(#99CCFF, #FFFFFF);
    behavior: url(PIE/PIE.htc);
}

.Nav_Bar_L3 {
    border-radius: 5px;
    -pie-background: linear-gradient(#CCCCCC, #FFFFFF);
    behavior: url(PIE/PIE.htc);
}
最后是我的javascript文件:

document.write('<table class="Nav_Bar">             ');
document.write('    <tr>                            ');
document.write('        <td class="Nav_Bar_L1">     ');
document.write('        Heading 1</td>              ');
document.write('                                    ');
document.write('    <tr>                            ');
document.write('        <td class="Nav_Bar_L2">     ');
document.write('            SubHeading 1</td>       ');
document.write('                                    ');
document.write('    <tr>                            ');
document.write('        <td class="Nav_Bar_L3">     ');
document.write('            SubSubHeading 1</td>    ');
document.write('                                    ');
document.write('    <tr>                            ');
document.write('        <td class="Nav_Bar_L1">     ');
document.write('            Heading 2</td>          ');
document.write('                                    ');
document.write('    <tr>                            ');
document.write('        <td class="Nav_Bar_L2">     ');
document.write('            SubHeading 2</td>       ');
document.write('                                    ');
document.write('    <tr>                            ');
document.write('        <td class="Nav_Bar_L3">     ');
document.write('            SubSubHeading 2</td>    ');
document.write('                                    ');
document.write('</table>                            ');
document.write(“”);
文件。写(“”);
文件。写(“”);
文件。编写(‘标题1’);
文件。写(“”);
文件。写(“”);
文件。写(“”);
文件。填写(‘子目1’);
文件。写(“”);
文件。写(“”);
文件。写(“”);
文件。编写(‘子标题1’);
文件。写(“”);
文件。写(“”);
文件。写(“”);
文件。编写(‘标题2’);
文件。写(“”);
文件。写(“”);
文件。写(“”);
文件。填写(‘子目2’);
文件。写(“”);
文件。写(“”);
文件。写(“”);
文件。编写(‘副标题2’);
文件。写(“”);
文件。写(“”);
同样,只有当我使用javascript导入代码时,问题才会继续存在

有什么想法吗

编辑:如果您不能提供解决方案,您可以提供另一种方法,在多个页面中包含代码块?我已经看过PhP和SSI,但我所使用的服务器不支持它,我无法更改:/

编辑:我正在使用Visual Lightbox在一个页面中包含一个图库。该页面不显示此问题,但是其他页面只显示文本内容。也许有帮助

编辑:好的,我已经设法解决了这个问题,尽管我真的不知道为什么它能工作。如果我在header部分加载jquery脚本,CSS效果加载就很好。我觉得很奇怪。有人有什么想法吗

<script src="path/jquery.min.js" type="text/javascript"></script>

使用PIE时的一个主要问题是它通常需要一个
位置:相对在元素上,也在父元素上,因为VML获取
位置:绝对。我不确定它是否与position:relative;配合得那么好


我希望这有助于更好地理解PIE。

我怀疑它能否解决您的问题,但您需要关闭导致以下结构的行:
content
。谢谢您的提示,但您是正确的,它没有解决我的问题:(我很乐意帮助您,但我以前从未遇到过这种情况,除非您使用窗口大小调整事件,否则没有任何理论解释,但如果您愿意,您可能知道问题出在哪里。非常抱歉。
document.write('<table class="Nav_Bar">             ');
document.write('    <tr>                            ');
document.write('        <td class="Nav_Bar_L1">     ');
document.write('        Heading 1</td>              ');
document.write('                                    ');
document.write('    <tr>                            ');
document.write('        <td class="Nav_Bar_L2">     ');
document.write('            SubHeading 1</td>       ');
document.write('                                    ');
document.write('    <tr>                            ');
document.write('        <td class="Nav_Bar_L3">     ');
document.write('            SubSubHeading 1</td>    ');
document.write('                                    ');
document.write('    <tr>                            ');
document.write('        <td class="Nav_Bar_L1">     ');
document.write('            Heading 2</td>          ');
document.write('                                    ');
document.write('    <tr>                            ');
document.write('        <td class="Nav_Bar_L2">     ');
document.write('            SubHeading 2</td>       ');
document.write('                                    ');
document.write('    <tr>                            ');
document.write('        <td class="Nav_Bar_L3">     ');
document.write('            SubSubHeading 2</td>    ');
document.write('                                    ');
document.write('</table>                            ');
<script src="path/jquery.min.js" type="text/javascript"></script>