Table Row innerHTML

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • romepatel
    New Member
    • Nov 2009
    • 31

    Table Row innerHTML

    Hello,

    I have an table, and i want to update whole row dynamically, according the user entered data......
    below is the example,

    Code:
    <html>
    <script type="text/javascript">
    function doThis()
    {
    	var strart_td ="<TD>";
    	var close_td  = "</TD>";
    	var str_value = '';
    	
    		str_value = str_value + strart_td + document.getElementById('txt1').value + close_td;
    				
    	document.getElementById('id_table').rows[0].innerHTML = str_value;
    }
    </script>
    </head>
    
    <body>
    		<div style="float:left;">
    		<input type="text" id="txt1" value="">
    		<input type="text" id="txt2" value="">
    		<input type="button" onClick="javascript:doThis();" value="Click Me to change the values of Table">
    		</div>
    		<div style="float:right;">
    		<table border="1" id="id_table">
    		<tr id="row1">
    			<td width="100">1</td>
    			<td width="100">2</td>
    		</tr>
    		<tr>
    			<td width="100">1</td>
    			<td width="100">2</td>
    		</tr>
    		</table>
    		</div>
    </body>
    </html>

    The above script works fine in Firefox, but its not working in IE 6,
    can somebody help me out.........!!!

    Thanks in advance........ !!!
    Last edited by Dormilich; Dec 30 '09, 10:52 AM. Reason: Please use [code] tags when posting code
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Do you get an error in IE6? Have you tried other versions of IE?

    Comment

    Working...