这是index.html
页面
<head>
<script src="js/jquery-1.3.js" type="text/javascript"></script>
<script src="js/jquery.easing.1.3.js" type="text/javascript"></script>
<script src="js/animated-menu.js" type="text/javascript"></script>
<script src="js/call.js" type="text/javascript"></script>
<script type="text/javascript" src="js/fade.js"></script>
</head>
<body>
<div class="header">
<div class="menu">
<ul>
<li class="green" >
<p><a href="index.html">Home</a></p>
<p class="subtext">The front page</p>
</li>
<li class="yellow" onclick="showHint(1)">
<p><a href="#">About</a></p>
<p class="subtext">More info</p>
</li>
<li class="red" onclick="showHint(2)">
<p><a href="#">Contact</a></p>
<p class="subtext">Get in touch</p>
</li>
<li class="blue">
<p><a href="#">Submit</a></p>
<p class="subtext">Send us your stuff!</p>
</li>
<li class="purple">
<p><a href="#">Terms</a></p>
<p class="subtext">Legal things</p>
</li>
</ul>
</div>
</div>
<div class="content" id="content"></div>
</body>
这是contact.html
我通过 AJAX 加载的
<head>
<script src="js/call.js" type="text/javascript"></script>
</head>
<body>
<p>Rollover a menu item to expand it.</p>
<h1>Hello Ajax</h1>
</body>
这是fade.js
文件
$(document).ready(function() {
$("body").css("display", "none");
$("body").fadeIn(2000);
});
最后是ajax调用
var XMLHttpRequestObject;
if(window.XMLHttpRequest)
{
XMLHttpRequestObject=new XMLHttpRequest();
}
else if(window.ActiveXObject)
{
XMLHttpRequestObject=new ActiveXObject("Microsoft.XMLHTTP");
}
function showHint(ide) {
if(XMLHttpRequestObject)
{
XMLHttpRequestObject.onreadystatechange=function() {
if(XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200)
{
document.getElementById("content").innerHTML=XMLHttpRequestObject.responseText;
}
}
if(ide=="0")
{
XMLHttpRequestObject.open("GET","index.html",true);
}
else if(ide=="1")
{
XMLHttpRequestObject.open("GET","about_me.htm",true);
}
else if(ide=="2")
{
XMLHttpRequestObject.open("GET","contact.htm",true);
}
XMLHttpRequestObject.send();
}
}
问题是当我单独调用联系页面时,淡入淡出效果正在起作用。但是当我contact.html
通过 AJAX 加载时,jQuery 效果不起作用。请帮忙。