使用下面的代码,通过单击导航菜单中的链接,我得到一个特定div(InnerHTML)中的html页面,但是,我有我的菜单il css样式,并在点击链接并获取页面后div,似乎我的nav li css已损坏并获得了我点击的页面的css样式并且在div中...我怎么能避免获取带有页面请求的CSS请求演示我,我无法找到一些东西有关。 谢谢。
<script>
function processAjax(url) {
if (window.XMLHttpRequest) { // Non-IE browsers
req = new XMLHttpRequest();
req.onreadystatechange = targetDiv;
try {
req.open("GET", url, true);
} catch (e) {
alert(e);
}
req.send(null);
} else if (window.ActiveXObject) { // IE
req = new ActiveXObject("Microsoft.XMLHTTP");
if (req) {
req.onreadystatechange = targetDiv;
req.open("GET", url, true);
req.send();
}
}
return false;
}
function targetDiv() {
if (req.readyState == 4) { // Complete
if (req.status == 200) { // OK response
document.getElementById("containerDiv").innerHTML = req.responseText;
} else {
alert("Problem: " + req.statusText);
}
}
}
</script>