Jump to content

how can i add an loading image in here?


$php_mysql$

Recommended Posts

i wish to add an loading image before the random.php displays content, how to do it?

			<script type="text/javascript">
	function getHTTPObject(){
		if (window.ActiveXObject) 
			return new ActiveXObject("Microsoft.XMLHTTP");
		else if (window.XMLHttpRequest) 
			return new XMLHttpRequest();
		else {
			alert("Your browser does not support AJAX.");
			return null;
		}
	}

	var inc=0;
	function callPHP(){
		httpObject = getHTTPObject();
		if (httpObject != null) {
			httpObject.open("GET", "http://localhost/script/random.php", true);
			httpObject.send(null);
			httpObject.onreadystatechange = setDiv;	
		}
		setTimeout("callPHP()", 5000);
	}

	function setDiv(){
		if(httpObject.readyState == 4){
			document.getElementById('oPut').innerHTML = httpObject.responseText;
		}
	}

	window.onload=callPHP;

	</script>	

Link to comment
https://forums.phpfreaks.com/topic/247826-how-can-i-add-an-loading-image-in-here/
Share on other sites

function setDiv(){

if(httpObject.readyState == 4){

document.getElementById('oPut').innerHTML = httpObject.responseText;

}

else

{

document.getElementById("oPut").innerHTML="<img src=\"images/003.gif\" height=\"20\" width=\"20\" />";

}

                   

}

 

window.onload=callPHP;

 

 

 

 

try it

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.