我试图在两个不同的DIV中加载两个不同的文件。下面是我使用一键点击两个函数
var please_wait = null;
function open_url(url, target) {
if (!document.getElementById) {
return false;
}
if (please_wait != null) {
document.getElementById("target").innerHTML = please_wait;
}
if (window.ActiveXObject) {
link = new ActiveXObject("Microsoft.XMLHTTP");
} else if (window.XMLHttpRequest) {
link = new XMLHttpRequest();
}
if (link == undefined) {
return false;
}
link.onreadystatechange = function() {
response(url, target);
}
link.open("GET", url, true);
link.send(null);
}
function response(url, target) {
if (link.readyState == 4) {
document.getElementById(target).innerHTML = (link.status == 200) ? link.responseText : "Ooops!! A broken link! Please contact the webmaster of this website and give him the following errorcode: " + link.status;
}
}
function set_loading_message(msg) {
please_wait = Loding;
}
和我使用这个代码的链接调用的代码...
<a href="javascript:void(0)" onclick="open_url('firstpage.php','containerA');open_url('secondpage.php','containerB')"> Click Here </a>
它只是在加载概情况下,后一个。我尝试了不同的东西,完全采用了两种不同的方法,例如open_url2,但没有用。它一次只能在DIV中加载一个请求。任何解决方案
感谢很多工作就像一个魅力。 –