Hi,
I have a XSL page with 3 tables and each table has a tbody element. When the page loads XML data is parsed into js objects. Once that is done I use DOM functions to add the data to the correct tables...well thats how its supposed to work. When I create the row using a createRow function i have written the first thing I do is acquire a handle to the table (its id is a parameter passed in) but this is where things get strange in IE. It finds the first tbody and adds the rows correctly but when it comes to the trying to find the 2nd tbody it falls over. I've tried getElementById, getElementsByTagName and getElementsByName but only 1 tbody is ever found.
My xsl page...
My createRow function
All this works perfectly in Mozilla. Has anyone seen this before or have i found a bug in IE?
Regards
Matt
"Success is 10% inspiration, 90% last minute changes
I have a XSL page with 3 tables and each table has a tbody element. When the page loads XML data is parsed into js objects. Once that is done I use DOM functions to add the data to the correct tables...well thats how its supposed to work. When I create the row using a createRow function i have written the first thing I do is acquire a handle to the table (its id is a parameter passed in) but this is where things get strange in IE. It finds the first tbody and adds the rows correctly but when it comes to the trying to find the 2nd tbody it falls over. I've tried getElementById, getElementsByTagName and getElementsByName but only 1 tbody is ever found.
My xsl page...
Code:
<table width="600" border="0" cellpadding="0" cellspacing="0">
<tbody id="mainbodypi" name="mainbodypi">
<tr>
<td width="284" height="19" valign="top">Case description </td>
<td width="122" valign="top">Date opened </td>
<td width="122" valign="top">Case code </td>
</tr>
<script type="text/javascript">
<xsl:for-each select="CASE">
xmlresults[xmlresults.length] = {code:"<xsl:value-of select='CASE_CODE'/>",
desc:"<xsl:value-of select='DESCRIPTION'/>",
case_int:"<xsl:value-of select='CASE_INT_CODE'/>",
date_o:"<xsl:value-of select='DATE_OPENED'/>",
vp_mscode:"<xsl:value-of select='UDDATA/FIELD4'/>",
vp_msname:"<xsl:value-of select='UDDATA/FIELD5'/>",
trnf_transtype_code:"<xsl:value-of select='UDDATA/FIELD8'/>",
trnf_transtype_name:"<xsl:value-of select='UDDATA/FIELD9'/>",
trnf_name:"<xsl:value-of select='UDDATA/FIELD10'/>",
trnf_code:""};
//alert(xmlresults.length);
</xsl:for-each>
addRows();
</script>
</tbody>
</table>
<br/>
<table width="600" border="0" cellpadding="0" cellspacing="0">
<tbody id="mainbodyulr" name="mainbodyulr">
<tr>
<td width="284" height="19" valign="top">Case description </td>
<td width="122" valign="top">Date opened </td>
<td width="122" valign="top">Case code </td>
</tr>
</tbody>
</table>
<br/>
<table width="600" border="0" cellpadding="0" cellspacing="0">
<tbody id="mainbodylessulr" name="mainbodylessulr">
<tr>
<td width="284" height="19" valign="top">Case description </td>
<td width="122" valign="top">Date opened </td>
<td width="122" valign="top">Case code </td>
</tr>
</tbody>
</table>
My createRow function
Code:
function createRow( tbody, colour, id, col1, col2, col3, rowclass ){
alert(tbody+" "+id+" "+col1+" "+col2+" "+col3);
var tablebody = document.getElementById( tbody );
//eval("var mainbody = " + tbody );
//var tablebody = document.getElementsByTagName( "tbody" );
//var tablebody = document.body.all(tbody);
if(!tablebody)
alert("the tbody element hasnt been found");
var row = document.createElement( "tr" );
row.setAttribute( "id", id ); // int code
row.setAttribute( "bgColor", colour );
row.className = rowclass;
var cell_a = document.createElement( "td" );
cell_a.setAttribute( "height", "12" );
//cell_a.setAttribute( "className","firstCol" );
cell_a.className = "firstCol";
//cell_a.setAttribute( "width","30%" );
var cell_link = document.createElement( "a" );
cell_link.setAttribute( "href","javascript:void(0)" );
//cell_link.setAttribute( "onclick","document_onclick()" );
cell_link.setAttribute( "id", id );
//cell_link.addEventListener("click",eventLis,false);
cell_link.onclick = new Function("openFC(this)");
//cell_link.setAttribute( "className", "insertedRowTitle" ); // this must be set
var link_txt = document.createTextNode( col1 );
cell_link.appendChild( link_txt );
cell_a.appendChild( cell_link );
row.appendChild( cell_a );
row.appendChild( insertCellInRow( col2 ) );
row.appendChild( insertCellInRow( col3 ) );
tablebody.appendChild( row );
}
All this works perfectly in Mozilla. Has anyone seen this before or have i found a bug in IE?
Regards
Matt
"Success is 10% inspiration, 90% last minute changes