2011-09-19 67 views
0

我用下面的jQuery代碼加載一個頁面時...背景在Internet Explorer中沒有顯示使用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"); 
} 

但是在Internet Explorer中沒有顯示背景圖片。我曾嘗試使用background: black url("grad.png");但這也不起作用。我也嘗試在JQuery代碼的同一頁面中包含樣式,但仍然沒有運氣。

+0

grad.png位於同一目錄比#stats的HTML?嘗試使用圖像的絕對URL – Einacio

+0

什麼版本的IE,以及如何以及何時調用函數displayStats()? – b01

+0

該圖像是在相同的目錄中,我也嘗試使用完整的網址。我使用的Internet Explorer版本是IE7 – Andy

回答

0

嗯..您的問題可能與​​函數本身(在Internet Explorer中)。我似乎記得遇到的問題與而回......

試試這個

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

這是行不通的。沒有負載。 – Andy

+0

我可以看到用'獲得()'函數? – Ben

+0

功能displayStats(){ \t \t $獲得( 'statsto.php',函數(修改後的代碼){ \t \t \t $( '#統計')的HTML(); \t \t}); \t} – Andy

相關問題