Help with check boxes anyone please :)

wxdqz

New Member
I have two functions one that allows the single selection of reports from check boxes on a page.

That function is selectReport.

The second function is selectReports. This function selects all reports and deselects all reports.

select report is called by clicking on a check box on the page. It works for the first selection but fails for andy subsequesnt selection.

select reports is called from the page by clicking on an image it works just fine.

can anyone help with the sytax and logic on the check boxes. I would like to enjoy December 30 my birthday and New Years.


function selectReport(rptID)
{
var oReportXML;
var oNodes;
var rptID;

m_lastSel = !m_lastSel;
oReportXML = document.all("xmlAvailableReport").XMLDocument;
alert(oReportXML.xml);
if (oReportXML)
{
oNodes = oReportXML.selectSingleNode('//reportList/rpts/type/rpt');

//rptID = oNodes.attributes.getNamedItem("id").nodeValue
if (m_lastSel)

{
oNodes.attributes.getNamedItem("sel").nodeValue = 1;
document.all("chk" + rptID).checked = true;
}
else
{
oNodes.attributes.getNamedItem("sel").nodeValue = 0;
document.all("chk" + rptID).checked = false;
}
}
}


function selectReports()
{
var oReportXML;
var oNodes;
var rptID;
var i;

m_lastSel = !m_lastSel;
oReportXML = document.all("xmlAvailableReport").XMLDocument;
//alert(oReportXML.xml);
if (oReportXML)
{
oNodes = oReportXML.selectNodes('//reportList/rpts/type/rpt');

for (i = 0; i < oNodes.length; i++)
{
rptID = oNodes.attributes.getNamedItem("id").nodeValue
if (m_lastSel)
{
oNodes.attributes.getNamedItem("sel").nodeValue = 1;
document.all("chk" + rptID).checked = true;
}
else
{
oNodes.attributes.getNamedItem("sel").nodeValue = 0;
document.all("chk" + rptID).checked = false;
}
}
}
if (m_lastSel)
{
document.all("imgCheck").title = "Uncheck All Templates"
window.status = "Uncheck All"
}
else
{
document.all("imgCheck").title = "Check All Templates"
window.status = "Check All"
}
}
 
Back
Top