₦airaland Forum

Welcome, Guest: Register • Login • With Google • Trending • Recent • New

Stats: 3,344,206 members, 8,510,647 topics. Date: Friday, 30 October 2026 at 06:58 PM

Toggle theme

Cmon's Posts

Nairaland Forum › Cmon's Profile › Cmon's Posts

1 2 3 4 5 6 7 8 ... 16 17 18 19 20 21 22 23 24 (of 28 pages)

Webmasters › Ajax/jscript Help by cmon(op): 12:24am On Oct 26, 2009
I will like the js below to be able to display a loading,  indication to alert the user that the page is loading. As I'm not an expert in this field, can you please modify it to function like that. It will be cool if the loading indicator can include a gif animator with filename loading.gif.

I'll deeply appreciate your help. The code of the .js file follows;


var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
var bustcacheparameter=""

function ajaxpage(url, containerid){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP"wink
}
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP"wink
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
if (bustcachevar) //if bust caching of external page
bustcacheparameter=(url.indexOf("?"wink!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)
}

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http"wink==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}

function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js"wink!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript"wink;
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css"wink!=-1){ //If object is a css file
fileref=document.createElement("link"wink
fileref.setAttribute("rel", "stylesheet"wink;
fileref.setAttribute("type", "text/css"wink;
fileref.setAttribute("href", file);
}
}
if (fileref!=""wink{
document.getElementsByTagName("head"wink.item(0).appendChild(fileref)
loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}

Education › Re: Futo Post Ume Scratch Card by cmon(m): 10:42am On Sep 17, 2009
Everything FUTO and FUTO post-ume, get it on www.futocomm.com

Also see reactions to the 2009/2010 post ume result. You don't have to join, just visit the site now and see for yourself
Education › Re: Federal University Of Technology, Owerri (futo) Post UME status by cmon(op): 11:50pm On Aug 22, 2009
Up! Up!! Up!!! you go!

1 2 3 4 5 6 7 8 ... 16 17 18 19 20 21 22 23 24 (of 28 pages)