Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"...object is closed" Error Message

Status
Not open for further replies.

SteveBurch

Programmer
Jul 17, 2000
5
0
0
BM
Hello,

I'm actually hoping that this is something very straightforward where someone will be able to point out that I have made some simple mistake (I'm very new to JS!). For the attached script, whenever I attempt to search or list on my XML file, I get the error "Operation is not allowed when the object is closed" - I'm not aware of any operation that I need to do to 'open' the XML data before I read it?

Also, I'm sure I had this working sometime ago, but now that I'm revisiting the project, it appears not to. Are there any settings that could affect whether this works (I'm attempting to run it within MS Frontpage).

If anyone has any ideas, or if I can provide any more information that may help troubleshoot this problem, I would appreciate your time and effort.

Thanks in advance,

Steve


The script:-

<html>
<head>
<title>Your Website Name</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../globalstyles/globalstyles.css">
<XML ID="nia_mapping" SRC="</XML>

<script LANGUAGE="JavaScript">

function setUpHTMLHeader()
{
var htmlString1 = " "

htmlString1 += '<TABLE BORDER="1" CELLSPACING="1" WIDTH="570">' +
'<tr>' +
'<td VALIGN="MIDDLE"><font FACE="Arial" SIZE="2">' +
'<p><b>Company</b></font></td>' +
'<td VALIGN="MIDDLE"><font FACE="Arial" SIZE="2">' +
'<p><b>IBS Acct</b></font></td>' +
'<td VALIGN="MIDDLE"><font FACE="Arial" SIZE="2">' +
'<p><b>Description</b></font></td>' +
'<td VALIGN="MIDDLE"><font FACE="Arial" SIZE="2">' +
'<p><b>CODA Nominal</b></font></td>' +
'<td VALIGN="MIDDLE"><font FACE="Arial" SIZE="2">' +
'<p><b>Description</b></font></td>' +
'<td VALIGN="MIDDLE"><font FACE="Arial" SIZE="2">' +
'<p><b>CODA Subacct</b></font></td>' +
'<td VALIGN="MIDDLE"><font FACE="Arial" SIZE="2">' +
'<p><b>Description</b></font></td>' +
'</tr><TBODY>';


return(htmlString1);
}

function listAll()
{
var htmlString1 = " ";
var htmlString2 = " ";
var htmlString3 = " ";

nia_mapping.recordset.moveFirst();

htmlString1 = setUpHTMLHeader();

while (!nia_mapping.recordset.EOF) {
htmlString2 += nullCheck();

nia_mapping.recordset.moveNext()
}

htmlString3 += "</TBODY></TABLE>"

divMessage8.innerHTML =
htmlString1 +
htmlString2 +
htmlString3
}

function nullCheck()
{
var htmlString2a = " ";

if (nia_mapping.recordset("COMPANY") == "")
{var nomCompany = "&nbsp;";}
else
{var nomCompany = nia_mapping.recordset("COMPANY");}

if (nia_mapping.recordset("IBS_NOM") == "")
{var nomIbsnom = "&nbsp;";}
else
{var nomIbsnom = nia_mapping.recordset("IBS_NOM");}

if (nia_mapping.recordset("IBS_DESC") == "")
{var nomIbsdesc = "&nbsp;";}
else
{var nomIbsdesc = nia_mapping.recordset("IBS_DESC");}

if (nia_mapping.recordset("IAS_NOM") == "")
{var nomIasnom = "&nbsp;";}
else
{var nomIasnom = nia_mapping.recordset("IAS_NOM");}

if (nia_mapping.recordset("IAS_DESC") == "")
{var nomIasdesc = "&nbsp;";}
else
{var nomIasdesc = nia_mapping.recordset("IAS_DESC");}

if (nia_mapping.recordset("SUBACC") == "")
{var nomSubacc = "&nbsp;";}
else
{var nomSubacc = nia_mapping.recordset("SUBACC");}

if (nia_mapping.recordset("SUB_DESC") == "")
{var nomSubdesc = "&nbsp;";}
else
{var nomSubdesc = nia_mapping.recordset("SUB_DESC");}

htmlString2a =
"<TR><TD>" +
nomCompany +
"</TD><TD>" +
nomIbsnom +
"</TD><TD>" +
nomIbsdesc +
"</TD><TD>" +
nomIasnom +
"</TD><TD>" +
nomIasdesc +
"</TD><TD>" +
nomSubacc +
"</TD><TD>" +
nomSubdesc +
"</TD></TR>";

return htmlString2a;

}

function searchNoms()
{
var searchForCompany = form1.text1.value.toLowerCase()

/* alert(searchForCompany)*/

var searchForIbsacct = form4.searchIbsacct.value.toLowerCase()
var searchForCodanom = form2.searchCodanom.value.toLowerCase()
var searchForCodasub = form3.searchCodasub.value.toLowerCase()
var resultCount = 0;
var htmlString2 = " "
var htmlString3 = " "

nia_mapping.recordset.moveFirst();

htmlString1 = setUpHTMLHeader();

divMessage8.innerHTML = "Searching...........please wait";

while (!nia_mapping.recordset.EOF) {
bCompanyOkay = 0
/* htmlString2 += "yyy"
htmlString2 += bCompanyOkay
htmlString2 += "yyy"*/
bIbsacctOkay = 0
bCodanomOkay = 0
bCodasubOkay = 0
if (searchForCompany == "") {
bCompanyOkay = 1
}
else {
var currentCompany = new String(nia_mapping.recordset("COMPANY"))
currentCompany = currentCompany.toLowerCase()
if (currentCompany.indexOf(searchForCompany) >= 0) {
/* htmlString2 += "search company = ";
htmlString2 += searchForCompany;
htmlString2 += "company is matched?!";*/
bCompanyOkay = 1
}
}
if (searchForIbsacct == "") {
bIbsacctOkay = 1
}
else {
var currentIbsacct = new String(nia_mapping.recordset("IBS_NOM"))
currentIbsacct = currentIbsacct.toLowerCase()
if (currentIbsacct.indexOf(searchForIbsacct) >= 0) {
bIbsacctOkay = 1
}
}
if (searchForCodanom == "") {
bCodanomOkay = 1
}
else {
var currentCodanom = new String(nia_mapping.recordset("IAS_NOM"))
currentCodanom = currentCodanom.toLowerCase()
if (currentCodanom.indexOf(searchForCodanom) >= 0) {
bCodanomOkay = 1
}
}
if (searchForCodasub == "") {
bCodasubOkay = 1
}
else {
var currentCodasub = new String(nia_mapping.recordset("SUBACC"))
currentCodasub = currentCodasub.toLowerCase()
if (currentCodasub.indexOf(searchForCodasub) >= 0) {
bCodasubOkay = 1
}
}
if (bCompanyOkay && bIbsacctOkay && bCodanomOkay && bCodasubOkay) {
htmlString2 += nullCheck();
/* htmlString2 += bCompanyOkay;*/
resultCount++;
}

nia_mapping.recordset.moveNext()
}

if (resultCount == 0) {
htmlString2 +=
"<TR><TD>" +
"No matches found" +
"</TD><TD>" +
"&nbsp;" +
"</TD><TD>" +
"&nbsp;" +
"</TD><TD>" +
"&nbsp;" +
"</TD><TD>" +
"&nbsp;" +
"</TD><TD>" +
"&nbsp;" +
"</TD><TD>" +
"&nbsp;" +
"</TD></TR>";
}

htmlString3 += "</TBODY></TABLE>"

divMessage8.innerHTML = "";
divMessage8.innerHTML = htmlString1 +
htmlString2 +
htmlString3;

}

function init()
{


wait.style.display='none'
}

</script>


<meta name="Microsoft Border" content="tlb, default">
</head>

<body bgcolor="#FFFFFF" text="#000000" background="../../globalimages/background01.gif" link="#0000CC" vlink="#CC0033" alink="#0000CC" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="610">
<tr>
<td width="20">&nbsp;</td>
<td width="450" align="left" valign="top"><b><font color="#004078" size="5">
CODA<br>
</font><font size="3">Business Area&nbsp; -&nbsp; Nominal Translation Search</font></b>
<p>(Press <b class="k1">'Reset Search'</b> button below to clear search results)</p>

<TABLE height="106" width="379">
<TR>
<TH ALIGN="CENTER" height="13" width="68" style="background-color: #C0C0C0">
<form name="form1" id="form1" >
<p>Company<br>
<input TYPE="TEXT" NAME="text1" SIZE="6"> </p>
</form>
</TH><TH ALIGN="CENTER" height="13" width="79" style="background-color: #C0C0C0">
<form ID="form4">
<p align="center">IBS Acct&nbsp;<br>
<input TYPE="TEXT" NAME="searchIbsacct" SIZE="5"> </p>
</form>
</TH><TH ALIGN="CENTER" height="13" width="102" style="background-color: #C0C0C0">
<form ID="form2">
<p>CODA Nominal<br>
<input TYPE="TEXT" NAME="searchCodanom" SIZE="5"> </p>
</form>
</TH><TH ALIGN="CENTER" height="13" width="104" style="background-color: #C0C0C0">
<form ID="form3">
<p>CODA Subacct<br>
<input TYPE="TEXT" NAME="searchCodasub" SIZE="6"> </p>
</form>
</TH>
</TR><TR>
<TH ALIGN="CENTER" COLSPAN="4" height="27" width="1561" style="background-color: #C0C0C0"><input TYPE="BUTTON" VALUE="Search" ONCLICK="searchNoms()"> </TH>
</TR>
</TABLE>
<TABLE height="36" width="376">
<tr>
<TH ALIGN="CENTER" COLSPAN="2" height="1" width="153"><form><input TYPE="button" VALUE="List all records" onClick="listAll()"></form></TH>
<TH ALIGN="CENTER" COLSPAN="2" height="1" width="202"><form><input TYPE="button" VALUE="Reset Search" onClick="location.reload()"></form></TH>
</tr>
</TABLE>

<div ID="divMessage1"></div>

<div ID="divMessage5"></div>

<div ID="divMessage6"></div>

<div ID="divMessage7"></div>

<div ID="divMessage8"></div>

<div id="wait" style="color:cc0000">&nbsp;</div>

<p>&nbsp;</p>
<p>&nbsp;</td>
<td width="140" align="left" valign="top">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="140">
<tr>
<td width="10" align="left" valign="top">
&nbsp;</td>
<td width="130" align="left" valign="top"><b>&nbsp;</b></td>
</tr>
<tr>
<td width="10" align="left" valign="top">
</td>
<td width="130" align="left" valign="top"></td>
</tr>
<tr>
<td width="10" align="left" valign="top">
</td>
<td width="130" align="left" valign="top"></td>
</tr>
<tr>
<td width="10" align="left" valign="top">
</td>
<td width="130" align="left" valign="top"></td>
</tr>
<tr>
<td width="10" align="left" valign="top">
</td>
<td width="130" align="left" valign="top"></td>
</tr>
<tr>
<td width="10" align="left" valign="top">
</td>
<td width="130" align="left" valign="top"></td>
</tr>
</table>
</td>
</tr>
</table>

&nbsp;</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top