当使用JQuery加载功能时,背景不显示在ie浏览器中


Background not showing in internet explorer when using JQuery load function

我使用下面的jquery代码来加载一个页面…

$(function() {
$('#stats').load('statsto.php');
    var visibleInterval = 60000;
    var invisibleInterval = 120000;
    $(function() {
        setTimer();
        $(document).bind('visibilitychange'), function() {
            clearTimeout(timer);
            setTimer();    
        };
    });
    function displayStats() {
        $('#stats').load('statsto.php');
        $.ajaxSetup({ cache: false });
    }
    function setTimer() {
        timer = setInterval(displayStats, (document.hidden) ? invisibleInterval : visibleInterval);
    }
});

,下面是来自statsto.php的样式…

body {
font-family: Verdana;
font-size: 7px;
color: #FFFFFF;
background-color: #000000;
background-image: url("grad.png");
}

但是背景图片在ie中显示不出来。我试过使用background: black url("grad.png");,但这也不起作用。我也尝试过在JQuery代码的同一页面中包含样式,但仍然没有运气

嗯…您的问题可能与.load()功能本身有关(在Internet Explorer中)。我好像记得前阵子遇到过一个问题……

试试这个

$.get('statso.php', function() {
  $('#stats').html();
});