我正在使用一個腳本來加載另一個頁面,其中包含一個post值來更新SQL查詢。 它在safari中工作,但在IE8中不起作用。我不知道如何解決它。 正如您所看到的,頁面全部爲空,但確實包含元素。 所以我假設.load函數有問題。jQuery .load在IE8中不起作用
鏈接:http://tamara.gwst.nl/infiniteScroll/index.php
的index.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Web Gallery | Infinite Scroll</title>
<link rel="stylesheet" href="style.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
<script type="text/javascript" src="js/main.js"></script>
<script type="text/javascript" src="js/jquery.infinitescroll.js"></script>
</head>
<body>
<?php include('includes/connect.php'); ?>
<div id="content"></div>
</body>
</html>
main.js
$("document").ready(function(){
$("#content").load("scroll.php", {limit: 5});
var counter = 5;
$(window).scroll(function(){
if($(window).scrollTop() + 1 > $(document).height() - $(window).height()){
counter = counter + 5;
$("#content").load("scroll.php", {limit: counter});
}
});
});
scroll.php
<? $limit = $_POST['limit']; ?>
<?
include('includes/connect.php');
$sql = "SELECT name FROM scroll_images LIMIT $limit";
echo "</div>";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result)){
echo "<div class='post'><img src='img/".$row['name']. ".jpg' /></div>";
}
?>
嗯,這是不是solution..unfortunately。我用其他版本的模擬器測試過它。但它似乎並不適用於IE。 – Tamara
@ user1648471:模擬器?什麼模擬器?唯一真正的測試是在實際的瀏覽器版本本身內。 MS提供免費下載的每個瀏覽器版本的Virtual PC和硬盤驅動器映像。 IMSoP是100%正確的,你不能在'document.ready'裏面放置''''document'。 – Sparky
我已經從我的代碼中刪除了它。還測試它在真正的瀏覽器版本(IE8) – Tamara