snowboardr
Programmer
This function is causing an error, but it still shows layer etc... I am using it for ajax loading image... the error occurs inside the createboject / ajax when i take the hideLayer part out it doesn't error, and the layer stays visible, however when its in there i get this error in firefox:
Error: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: :: getLoadMAINHTMLHttpResponse :: line 72" data: no]
Source File: Line: 72
In Internet explorer i get unspecified error.
I take it from the error it has something to do with the netscape code because of "NS"
Error: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: :: getLoadMAINHTMLHttpResponse :: line 72" data: no]
Source File: Line: 72
In Internet explorer i get unspecified error.
I take it from the error it has something to do with the netscape code because of "NS"
Code:
var LoadMAINHTMLHttp = null;
function LoadMAINHtml(strCategoryName) {
showLayer('LoadingImage2');
LoadMAINHTMLHttp = createRequestObject();
var url3="/ajax/main_topics.asp?cat_name=" + strCategoryName
LoadMAINHTMLHttp.open('GET', url3, true);
LoadMAINHTMLHttp.onreadystatechange = getLoadMAINHTMLHttpResponse;
LoadMAINHTMLHttp.send('');
}
function getLoadMAINHTMLHttpResponse() {
if (LoadMAINHTMLHttp != null)
if (LoadMAINHTMLHttp.readyState == 4)
hideLayer('LoadingImage2');
if (LoadMAINHTMLHttp.status == 200)
document.getElementById('topics').innerHTML = LoadMAINHTMLHttp.responseText;
}
Code:
function showLayer(layerName)
{
if (document.getElementById) // Netscape 6 and IE 5+
{
var targetElement = document.getElementById(layerName);
targetElement.style.visibility = 'visible';
}
}
function hideLayer(layerName)
{
if (document.getElementById)
{
var targetElement = document.getElementById(layerName);
targetElement.style.visibility = 'hidden';
}
}