sudhaoncyberworld@gmail.com wrote:[color=blue]
>
> Thanks for ur replies, Sorry, in my subject i wrongly mentioned as
> innertext instead of InnerHTML and i tried with table also, that also
> throwing the same error (i am using IE 6) and eventhough i did not add
> the tbody it is automatically adding table body, ie. y i added myself.[/color]
A tbody element is mandatory even though the tags are optional.
Browsers will add a tbody element where it is needed.
[color=blue]
> so i try with createElement
>
> <script language=javascript>[/color]
The language attribute is deprecated, type is required:
<script type="text/javascript">
[color=blue]
> function test()
> {
> alert(document.getElementById('tbl1').innerHTML);
> document.getElementById('tbl1').innerHTML+='<tr><t d>EFG</td></tr>';[/color]
Replace the above line with:
if (!document.getElementById || !document.createElement) return;
var row = document.getElementById('tbl1').insertRow(-1);
var cell = document.createElement('td');
cell.appendChild(document.createTextNode('EFG'));
row.appendChild(cell);
[color=blue]
>
> }
> </script>
> <body>
> <table id='tbl1'>
> <tr>
> <td onmouseover=test() >
> ABC
> </td>
> </tr>
> </table>
> </body>
> </html>
>[/color]
--
Rob