我有这个 javascript:
function createRequestObject(){
var req;
if(window.XMLHttpRequest){
//For Firefox, Safari, Opera
req = new XMLHttpRequest();
}
else if(window.ActiveXObject){
//For IE 5+
req = new ActiveXObject("Microsoft.XMLHTTP");
}
else{
//Error for an old browser
alert('Your browser is not IE 5 or higher, or Firefox or Safari or Opera');
}
//alert (req);
return req;
}
//Make the XMLHttpRequest Object
var http = createRequestObject();
function sendRequestTwo(method, url, head1){
head = head1
if(method == "get" || method == "GET"){
http.open(method,url);
http.onreadystatechange = handleResponseTwo;
http.send(null);
}
}
var head; //divs name
function handleResponseTwo(){
if(http.readyState == 4 && http.status == 200){
var response = http.responseText;
if(response){
document.getElementById(head).innerHTML = response;
}
}
}
这部分
document.getElementById(head).innerHTML = response;
将结果粘贴回我的页面。如何在页面完全加载之前显示“正在加载”?