B
bissatch
Hi,
I have the following simple HTML page. I am trying to get the innerHTML
of the table element, "xmltable". I do intend to change the innerHTML
of this table but at this stage I am having simple problems.
When I create the following page, note that 'onload' the loadfunction()
function is run. In this function all that is happening is that it is
chacking that the browser supports getElementById and then display an
alert with the contents of element "xmltable":
<html>
<head>
<script>
<!--
function loadfunction() {
if (document.getElementById) {
alert(document.getElementById("xmltable").innerHTML);
}
}
-->
</script>
</head>
<body onload="loadfunction();">
<table width="300" id="xmltable">
<tr>
<td width="100">First Name</td>
<td width="100">Surname</td>
<td width="100">Age</td>
</tr>
</table>
</body>
</html>
The alert, however, is slightly different that what is actually
contained within "xmltable". I am getting the following:
<TBODY>
<TR>
<TD width=100>First Name</TD>
<TD width=100>Surname</TD>
<TD width=100>Age</TD>
</TR><TBODY>
Apart from the fact that the tags are in caps, what is the TBODY tags
as they are not there. How do I just get the actual string value of the
contents within "xmltable" and not the above. And more importantly, how
do I change the contents to insert a different row markup because ...
document.getElementById("xmltable").innerHTML = newHTML;
.... doesnt work.
Cheers
Burnsy
I have the following simple HTML page. I am trying to get the innerHTML
of the table element, "xmltable". I do intend to change the innerHTML
of this table but at this stage I am having simple problems.
When I create the following page, note that 'onload' the loadfunction()
function is run. In this function all that is happening is that it is
chacking that the browser supports getElementById and then display an
alert with the contents of element "xmltable":
<html>
<head>
<script>
<!--
function loadfunction() {
if (document.getElementById) {
alert(document.getElementById("xmltable").innerHTML);
}
}
-->
</script>
</head>
<body onload="loadfunction();">
<table width="300" id="xmltable">
<tr>
<td width="100">First Name</td>
<td width="100">Surname</td>
<td width="100">Age</td>
</tr>
</table>
</body>
</html>
The alert, however, is slightly different that what is actually
contained within "xmltable". I am getting the following:
<TBODY>
<TR>
<TD width=100>First Name</TD>
<TD width=100>Surname</TD>
<TD width=100>Age</TD>
</TR><TBODY>
Apart from the fact that the tags are in caps, what is the TBODY tags
as they are not there. How do I just get the actual string value of the
contents within "xmltable" and not the above. And more importantly, how
do I change the contents to insert a different row markup because ...
document.getElementById("xmltable").innerHTML = newHTML;
.... doesnt work.
Cheers
Burnsy