Reverse the order and the sense of the opening tests (changes red):
Code:
function ajaxpage(url, containerid){
var page_request = false
if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
}
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
if (bustcachevar) //if bust caching of external page
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET'
But, as the XMLHttpRequest is more efficient and can be used live by IE 7, this shouldn't be used with a live implementation. It will allow for local testing in IE 7, and, if your primary usage will be local, is perfectly fine.
Bookmarks