我試圖在兩個不同的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中加載一個請求。任何解決方案
感謝很多工作就像一個魅力。 –