如何将window.location
放入同一HTML页面的div中?这是我现在拥有的:
function x {
var httpxml;
if (window.XMLHttpRequest) {
httpxml = new XMLHttpRequest();
}
else {
httpxml = new ActiveXObject("Microsoft.XMLHTTP");
}
httpxml.open("GET", "Home.aspx", true);
httpxml.send();
httpxml.onreadystatechange = function() {
if (httpxml.status == 200 && httpxml.readyState == 4) {
// what can i write here to show Home.aspx page into div at default.aspx page
}
}
}
答案 0 :(得分:1)
假设您div
id
为div1
:
if (httpxml.status == 200 && httpxml.readyState == 4) {
document.getElementById("div1").innerHTML = httpxml.responseText;
}
答案 1 :(得分:0)
你可以简单地使用jQuery。例如:
$('div.class').load('mypage.html');
......或:
$('#mydivID').load('mypage.html');