$php_mysql$ Posted September 25, 2011 Share Posted September 25, 2011 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 More sharing options...
Sajesh Mohan Posted September 26, 2011 Share Posted September 26, 2011 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 Link to comment https://forums.phpfreaks.com/topic/247826-how-can-i-add-an-loading-image-in-here/#findComment-1272878 Share on other sites More sharing options...
$php_mysql$ Posted September 29, 2011 Author Share Posted September 29, 2011 hi thanks i actually have tried that before but nothing showed Link to comment https://forums.phpfreaks.com/topic/247826-how-can-i-add-an-loading-image-in-here/#findComment-1273992 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.