javascript - When the last insert table row is deleted, the width of second cell of first table row became 0 -


I am sorry that I can not find the correct title of my problem. I wrote a simple web page and some javascript in which the table The row of was inserted and it was removed. Now my problem is that when I delete the last inserted row, the second cell of the first row row width becomes zero in IE6. Can someone give me some advice?

& lt; Html & gt; & Lt; Top & gt; & Lt; Meta http-equiv = "content-type" content = "text / html; charset = UTF-8" & gt; & Lt; Script type = "text / javascript" & gt; Function deleteRow (r) {var i = r.parentNode.parentNode.rowIndex; Document.getElementById ('mytable') deleteRow (i). } Function insertRowInTable () {var table = document.getElementById ("myTable"); Var lastRow = table.rows.length; Var newRow = table.insertRow (last time); Var i = 0; (; I & lt; 9; i ++) for {var td = newRow.insertCell (-1); Td.innerHTML = "" + i; } NewRow.insertCell (-1) .innerHTML = "& lt; input type = 'button' value = 'delete' + newRow.rowIndex +" 'onclick =' deleteRow (this) '& gt; "; } & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Tab id = myTable width = 450 range = 1> & Lt; Tbody & gt; & Lt; TR width = "450" ​​& gt; & Lt; TD Width = 225 colSpan = 7 & gt; Line 3 & lt; / TD> & Lt; TD width = 225 colSpan = 3 & gt; & Lt; INPUT onclick = insertRowInTable (); Type = button value = insert & gt; & Lt; / TD> & Lt; / TR & gt; & Lt; / TBODY & gt; & Lt; / Table & gt; & Lt; / BODY & gt; & Lt; / Html & gt; Use the inline-style just for the table "Table-Layout: Fixed"

  & lt; Tab id = myTable width = 450 border = 1 style = "table-layout: fixed" & gt; & Lt; TBODY & gt; & Lt; TR width = "450" ​​& gt; & Lt; TD Width = 225 colSpan = 7 & gt; Line 3 & lt; / TD> & Lt; TD width = 225 colSpan = 3 & gt; & Lt; INPUT onclick = insertRowInTable (); Type = button value = insert & gt; & Lt; / TD> & Lt; / TRDA & lt; / TBODY & gt; & Lt; / TABLE & gt;  

And it will work for you.

Thank you.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -