Changing the innerHTML of elements in a nested div tag..
        Posted  
        
            by PoorCoder
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by PoorCoder
        
        
        
        Published on 2010-05-06T01:17:39Z
        Indexed on 
            2010/05/06
            1:28 UTC
        
        
        Read the original article
        Hit count: 340
        
-- Representative code only - I need to know how to change the innerhtml of the tablerow --
<html>
<head>
<script> //full javascript declaration - function call after page loads..
function ()
{
document.getElementById('tr1').innerHTML='<td>Test</td>'; // does not work..
document.getElementByTagNames('tr')[0].innerHTML='<td>Test</td>'; // does not work..
document.getElementById('div2').getElementsByTagNames('tr')[0].innerHTML='<td>Test</td>'; //does not work..
document.getElementById('div1').div2.tr1.innerHTML='<td>Test</td>'; //nope
}
</script>
</head>
<body>
<div id='div1'>
    <div id='div2'>
        <table>
            <tr id='tr1'></tr>
        </table>
    </div>
</div>
</body>
</html>
Thanks for the help
© Stack Overflow or respective owner