Blank page trying to set display on Tables

J

jbrown

I'm binding xml to HTML. Works fine pre IE7. I have an InnerTable ID
on each table which could be suppressed (display:none) if no data is
bound to the objects in the table from the xml. However if the first
table has enough data to bind beyond a printable page, several blank
lines separate the top level table that is displayed and the
unsuppressed child table. The entire HTML is posted below: If you
run it in an IE7 browser, then do print preview you'll see the
problem. Also if you get the message about allowing blocked content
you have to enable that first for script to run before you'll be able
to see it. Here's the code:
<HTML>
<HEAD>
<xml id="ReportData">
<ReportData>
<Verbal>
<Medications Test="test">
<Changed>
<Medication OldMainDrugName="polyethylene glycol
3350" NewMainDrugName="polyethylene glycol 3350"
VerbalOrderMedicationID="634" VerbalOrderID="672" Today="02-26-2007"
OldGenericName="polyethylene glycol 3350" NewGenericName="polyethylene
glycol 3350" OldBrandName="GlycoLax" NewBrandName="GlycoLax"
OldDispensableName="polyethylene glycol 3350 oral powder for
reconstitution" NewDispensableName="polyethylene glycol 3350 oral
powder for reconstitution" OldAmount="3" NewAmount="3"
OldDrugFrequency="1d" NewDrugFrequency="2w" OldDrugStatus="New"
NewDrugStatus="Changed" OldRoute="PO" NewRoute="PO"
OldGenericInHome="1" NewGenericInHome="1" OldDrugStart="04-18-2005"
NewDrugStart="04-18-2005" OldNote="These are the med notes. New med
added will be merged in verbal." OldHospiceProvided=""
NewHospiceProvided="" DrugAction="Update" MedRowID="31B74B49-57FB-4E51-
B9A7-F385325100AC">
</Medication>
</Changed>
<Changed>
<Medication OldMainDrugName="gonadorelin"
NewMainDrugName="gonadorelin" VerbalOrderMedicationID="635"
VerbalOrderID="672" Today="02-26-2007" OldGenericName="gonadorelin"
NewGenericName="gonadorelin" OldBrandName="Factrel"
NewBrandName="Factrel" OldDispensableName="gonadorelin 0.1 mg
intravenous injection" NewDispensableName="gonadorelin 0.1 mg
intravenous injection" OldAmount="2" NewAmount="4"
OldDrugFrequency="1d" NewDrugFrequency="1d" OldDrugStatus="New"
NewDrugStatus="Changed" OldRoute="PO" NewRoute="PO"
OldGenericInHome="1" NewGenericInHome="1" OldDrugStart="04-18-2005"
NewDrugStart="04-18-2005" OldNote="These are the med notes. New med
added will be merged in verbal." NewNote="These are the med notes. New
med added will be merged in verbal." OldHospiceProvided=""
NewHospiceProvided="" DrugAction="Update"
MedRowID="F011764E-0245-4076-9DDE-BB5BFF2D14AA">
</Medication>
</Changed>
<Changed>
<Medication OldMainDrugName="methadone"
NewMainDrugName="methadone" VerbalOrderMedicationID="636"
VerbalOrderID="672" Today="02-26-2007" OldGenericName="methadone"
NewGenericName="methadone" OldBrandName="Dolophine"
NewBrandName="Dolophine" OldDispensableName="methadone 10 mg oral
tablet" NewDispensableName="methadone 10 mg oral tablet" OldAmount="2"
NewAmount="2" OldDrugFrequency="1d" NewDrugFrequency="1d"
OldDrugStatus="New" NewDrugStatus="Changed" OldRoute="PO"
NewRoute="IM" OldGenericInHome="1" NewGenericInHome="1"
OldDrugStart="04-18-2005" NewDrugStart="04-18-2005" OldNote="These are
the med notes. New med added will be merged in verbal." NewNote="These
are the med notes. New med added will be merged in verbal."
OldHospiceProvided="" NewHospiceProvided="" DrugAction="Update"
MedRowID="6507341E-09A6-4265-AD69-E0D71CDA5361">
</Medication>
</Changed>
<Changed>
<Medication OldMainDrugName="Adalat CC"
NewMainDrugName="NIFEdipine" VerbalOrderMedicationID="637"
VerbalOrderID="672" Today="02-26-2007" OldGenericName="NIFEdipine"
NewGenericName="NIFEdipine" OldBrandName="Adalat CC"
NewBrandName="Adalat CC" OldDispensableName="NIFEdipine 90 mg oral
tablet, extended release" NewDispensableName="NIFEdipine 90 mg oral
tablet, extended release" OldAmount="2" NewAmount="2"
OldDrugFrequency="1d" NewDrugFrequency="1d" OldDrugStatus="New"
NewDrugStatus="Changed" OldRoute="PO" NewRoute="PO"
OldGenericInHome="0" NewGenericInHome="1" OldDrugStart="04-18-2005"
NewDrugStart="04-18-2005" OldHospiceProvided="" NewHospiceProvided=""
DrugAction="Update" MedRowID="A5D992A8-D918-46B3-8909-A7E7435E1592">
</Medication>
</Changed>
</Medications>
</Verbal>
</ReportData>
</xml>
<TITLE></TITLE>
<SCRIPT Language="VBScript">
Dim xmlready
Dim bodyready
xmlready = false
bodyready = false
sub BodyLoad()
Dim NumTables
Dim i
Dim Tables
If xmlready and bodyready then
set Tables = document.all.namedItem("InnerTable")
NumTables = Tables.length
for i = 0 to NumTables-1
Dim j
Dim k
Dim b1
Dim b2
b1 = false
b2 = false
if (Tables(i).rows.length = 0) then
b1 = true
else
for j = 0 to Tables(i).rows.length - 1
for k = 0 to Tables(i).rows(j).cells.length - 1
Dim cell
Dim node
Set Cell = Tables(i).rows(j).cells(k)
Set node = cell.firstChild
do while (Not (node is nothing) and b1 =
false and b2 = false)
if (Not (node.attributes is nothing)) then
Dim DataSrc
Dim DataFld
Set DataSrc =
node.attributes.getNamedItem("DataSrc")
Set DataFld =
node.attributes.getNamedItem("DataFld")
if (Not (DataSrc is nothing) and Not
(DataFld is nothing)) then
if (Not IsNull(DataSrc.nodeValue)
and Not IsNull(DataFld.nodeValue)) then
if (node.innerText = "") then
b1 = true
else
b2 = true
end if
end if
end if
end if
Set node = node.nextSibling
loop
if (b1) then exit for
next
if (b1) then exit for
next
end if
Dim OuterTable
Dim CurObject
set CurObject = Tables(i).parentNode
set OuterTable = Nothing
do while (OuterTable is Nothing)
if ( CurObject.tagName = "TABLE" ) then
set OuterTable = CurObject
else
set CurObject = CurObject.parentNode
end if
loop
if (b1) then
OuterTable.style.display = "none"
else
OuterTable.style.display = "inline"
end if
next
divMain.style.display = "inline"
set Tables = Nothing
end if
end sub
</SCRIPT>
<SCRIPT Language="VBScript">
sub BodyLoaded
bodyready = true
BodyLoad
end sub
sub xmlloaded
xmlready = true
BodyLoad
end sub
</SCRIPT>
<SCRIPT Language="VBScript" for="ReportData"
event="ondatasetcomplete">
if ReportData.readyState = "complete" then
xmlloaded
end if
</SCRIPT>
<SCRIPT Language="VBScript" for="InnerTable"
event="onreadystatechange">
if window.event.srcElement.readyState = "complete" then
xmlloaded
end if
</SCRIPT>
<style type="text/css">
<!--
td { padding: 1px 0px 2px 0px; }
-->
</style>
</HEAD>
<BODY onload="BodyLoaded" style="margin: 0px;">
<CENTER>
<DIV id="divMain">
<table cellspacing="0" cellpadding="0">
<TR>
<TD style="text-align: center;">CONFIRMATION OF ORDER</TD>
</TR>
</TABLE>
</DIV>
<CENTER>
<TABLE cellspacing="0" cellpadding="0" DataSrc="#ReportData"
DataFld="Verbal" width="100%" border="1">
<TR>
<TD>
<TABLE cellspacing="0" cellpadding="0" border="1"
width="100%">
<TR>
<TD>
<table cellspacing="0" cellpadding="0"
DataSrc="#ReportData" DataFld="Medications" ID="InnerTable"
width="100%">
<TR>
<TD>
<TD Style="display: none;"><SPAN DataSrc="#ReportData"
DataFld="Test"></SPAN></TD>
</TD>
</TR>
</TABLE>
</TD>
</TR>
<TR>
<TD>
<TABLE cellspacing="0" cellpadding="0"
DataSrc="#ReportData" DataFld="Medications" width="100%">
<TR>
<TD>Medications</TD>
</TR>
<TR>
<TD>
<TABLE cellspacing="0" cellpadding="0"
DataSrc="#ReportData" DataFld="Changed">
<TR>
<TD><STRONG>Changed:</STRONG>
</TR>
<TR>
<TD>
<TABLE cellspacing="0" cellpadding="0"
DataSrc="#ReportData" DataFld="Medication" ID="InnerTable">
<TR>
<TD>From:</TD>
</TR>
<TR>
<TD>
<SPAN DataSrc="#ReportData"
DataFld="OldMainDrugName"></SPAN>
<SPAN DataSrc="#ReportData"
DataFld="OldDispensableName"></SPAN>
<SPAN DataSrc="#ReportData" DataFld="OldAmount"></
SPAN>
<SPAN DataSrc="#ReportData" DataFld="OldRoute"></
SPAN>
<SPAN DataSrc="#ReportData"
DataFld="OldDrugFrequency"></SPAN>
<SPAN DataSrc="#ReportData"
DataFld="OldHospiceProvided"></SPAN>
</TD>
</TR>
<TR>
<TD>Start Date:<SPAN DataSrc="#ReportData"
DataFld="OldDrugStart"></SPAN></TD>
</TR>
<TR>
<TD>Stop Date:<SPAN DataSrc="#ReportData"
DataFld="OldDrugStop"></SPAN></TD>
</TR>
<TR>
<TD><SPAN DataSrc="#ReportData"
DataFld="OldNote"></SPAN></TD>
</TR>
</TABLE>
</TD>
</TR>
<TR>
<TD>
<TABLE cellspacing="0" cellpadding="0"
DataSrc="#ReportData" DataFld="Medication">
<TR>
<TD>To:</TD>
</TR>
<TR>
<TD>
<SPAN DataSrc="#ReportData"
DataFld="NewMainDrugName"></SPAN>
<SPAN DataSrc="#ReportData"
DataFld="NewDispensableName"></SPAN>
<SPAN DataSrc="#ReportData" DataFld="NewAmount"></
SPAN>
<SPAN DataSrc="#ReportData" DataFld="NewRoute"></
SPAN>
<SPAN DataSrc="#ReportData"
DataFld="NewDrugFrequency"></SPAN>
<SPAN DataSrc="#ReportData"
DataFld="NewHospiceProvided"></SPAN>
</TD>
</TR>
<TR>
<TD>Start Date:<SPAN DataSrc="#ReportData"
DataFld="NewDrugStart"></SPAN></TD>
</TR>
<TR>
<TD>Stop Date:<SPAN DataSrc="#ReportData"
DataFld="NewDrugStop"></SPAN></TD>
</TR>
<TR>
<TD><SPAN DataSrc="#ReportData"
DataFld="NewNote"></SPAN></TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</CENTER>
</BODY>
</HTML>

You'll see that if you remove the last Changed node from the xml
datasource the problem goes away.
Thanks in advance for any help provided.
 
B

Bob I

You may want to pose your question to the Internet Explorer group for
the best response.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top