Skip to main content
Commonmark migration
Source Link
<script type="text/javascript" language="javascript">
 function addNewRow()
 {
    var table = document.getElementById("table1");
    var tr = table.insertRow();
    var td = tr.insertCell();
    td.innerHTML= "a";

    td = tr.insertCell();
    td.innerHTML= "b";
    
    td = tr.insertCell();
    td.innerHTML= "c";
    
    td = tr.insertCell();
    td.innerHTML= "d";
    
    td = tr.insertCell();
    td.innerHTML= "e";
 }
</script>
<body>
    <table id="table1" border="1" cellpadding="0" cellspacing="0" width="100%">
        <tr id="row1">
            <td>1</td>
            <td>2</td>
            <td>3</td>
            <td>4</td>
            <td>5</td>
        </tr>
    </table>
    <input type="button" onClick="addNewRow()" value="Add New"/>
</body>

This example is for dynamically insert new row and cells in the table. But its behavior is different in all browsers.

  1. Internet Explorer = It add row in the last and new added cells are starts from first.

    Internet Explorer = It add row in the last and new added cells are starts from first.

  2. Chrome/Safari = It add new row in the first and new added cells are starts from end.

    Chrome/Safari = It add new row in the first and new added cells are starts from end.

  3. Mozilla Firefox = It is not working.

    Mozilla Firefox = It is not working.

    I want new added row in the last and new added cells starts from first like (Internet Explorer) in all browsers.

I want new added row in the last and new added cells starts from first like (Internet Explorer) in all browsers.

If you have any solution for same behavior please tell me.

<script type="text/javascript" language="javascript">
 function addNewRow()
 {
    var table = document.getElementById("table1");
    var tr = table.insertRow();
    var td = tr.insertCell();
    td.innerHTML= "a";

    td = tr.insertCell();
    td.innerHTML= "b";
    
    td = tr.insertCell();
    td.innerHTML= "c";
    
    td = tr.insertCell();
    td.innerHTML= "d";
    
    td = tr.insertCell();
    td.innerHTML= "e";
 }
</script>
<body>
    <table id="table1" border="1" cellpadding="0" cellspacing="0" width="100%">
        <tr id="row1">
            <td>1</td>
            <td>2</td>
            <td>3</td>
            <td>4</td>
            <td>5</td>
        </tr>
    </table>
    <input type="button" onClick="addNewRow()" value="Add New"/>
</body>

This example is for dynamically insert new row and cells in the table. But its behavior is different in all browsers.

  1. Internet Explorer = It add row in the last and new added cells are starts from first.
  2. Chrome/Safari = It add new row in the first and new added cells are starts from end.
  3. Mozilla Firefox = It is not working.

I want new added row in the last and new added cells starts from first like (Internet Explorer) in all browsers.

If you have any solution for same behavior please tell me.

<script type="text/javascript" language="javascript">
 function addNewRow()
 {
    var table = document.getElementById("table1");
    var tr = table.insertRow();
    var td = tr.insertCell();
    td.innerHTML= "a";

    td = tr.insertCell();
    td.innerHTML= "b";
    
    td = tr.insertCell();
    td.innerHTML= "c";
    
    td = tr.insertCell();
    td.innerHTML= "d";
    
    td = tr.insertCell();
    td.innerHTML= "e";
 }
</script>
<body>
    <table id="table1" border="1" cellpadding="0" cellspacing="0" width="100%">
        <tr id="row1">
            <td>1</td>
            <td>2</td>
            <td>3</td>
            <td>4</td>
            <td>5</td>
        </tr>
    </table>
    <input type="button" onClick="addNewRow()" value="Add New"/>
</body>

This example is for dynamically insert new row and cells in the table. But its behavior is different in all browsers.

  1. Internet Explorer = It add row in the last and new added cells are starts from first.

  2. Chrome/Safari = It add new row in the first and new added cells are starts from end.

  3. Mozilla Firefox = It is not working.

    I want new added row in the last and new added cells starts from first like (Internet Explorer) in all browsers.

If you have any solution for same behavior please tell me.

removed deprecated tag [table] - https://meta.stackexchange.com/questions/198024/can-we-start-cleaning-up-table-tag-and-burninate-it-asap
Source Link

dynamically Dynamically insert new rows in the table

<script type="text/javascript" language="javascript">
 function addNewRow()
 {
    var table = document.getElementById("table1");
    var tr = table.insertRow();
    var td = tr.insertCell();
    td.innerHTML= "a";

    td = tr.insertCell();
    td.innerHTML= "b";
    
    td = tr.insertCell();
    td.innerHTML= "c";
    
    td = tr.insertCell();
    td.innerHTML= "d";
    
    td = tr.insertCell();
    td.innerHTML= "e";
 }
</script>
<body>
    <table id="table1" border="1" cellpadding="0" cellspacing="0" width="100%">
        <tr id="row1">
            <td>1</td>
            <td>2</td>
            <td>3</td>
            <td>4</td>
            <td>5</td>
        </tr>
    </table>
    <input type="button" onClick="addNewRow()" value="Add New"/>
</body>

This example is for dynamically insert new row and cells in the table. But its behavior is different in all browsers.

  1. Internet Explorer = It add row in the last and new added cells are starts from first.
  2. Chrome/Safari = It add new row in the first and new added cells are starts from end.
  3. Mozilla Firefox = It is not working.

Sir, I want new added row in the last and new added cells starts from first like  (InternerInternet Explorer) in all browsers.

If you have any solution for same behavior please tell me. Thanks,

dynamically insert new rows in the table

<script type="text/javascript" language="javascript">
 function addNewRow()
 {
    var table = document.getElementById("table1");
    var tr = table.insertRow();
    var td = tr.insertCell();
    td.innerHTML= "a";

    td = tr.insertCell();
    td.innerHTML= "b";
    
    td = tr.insertCell();
    td.innerHTML= "c";
    
    td = tr.insertCell();
    td.innerHTML= "d";
    
    td = tr.insertCell();
    td.innerHTML= "e";
 }
</script>
<body>
    <table id="table1" border="1" cellpadding="0" cellspacing="0" width="100%">
        <tr id="row1">
            <td>1</td>
            <td>2</td>
            <td>3</td>
            <td>4</td>
            <td>5</td>
        </tr>
    </table>
    <input type="button" onClick="addNewRow()" value="Add New"/>
</body>

This example is for dynamically insert new row and cells in the table. But its behavior is different in all browsers.

  1. Internet Explorer = It add row in the last and new added cells are starts from first.
  2. Chrome/Safari = It add new row in the first and new added cells are starts from end.
  3. Mozilla Firefox = It is not working.

Sir, I want new added row in the last and new added cells starts from first like(Interner Explorer) in all browsers.

If you have any solution for same behavior please tell me. Thanks,

Dynamically insert new rows in the table

<script type="text/javascript" language="javascript">
 function addNewRow()
 {
    var table = document.getElementById("table1");
    var tr = table.insertRow();
    var td = tr.insertCell();
    td.innerHTML= "a";

    td = tr.insertCell();
    td.innerHTML= "b";
    
    td = tr.insertCell();
    td.innerHTML= "c";
    
    td = tr.insertCell();
    td.innerHTML= "d";
    
    td = tr.insertCell();
    td.innerHTML= "e";
 }
</script>
<body>
    <table id="table1" border="1" cellpadding="0" cellspacing="0" width="100%">
        <tr id="row1">
            <td>1</td>
            <td>2</td>
            <td>3</td>
            <td>4</td>
            <td>5</td>
        </tr>
    </table>
    <input type="button" onClick="addNewRow()" value="Add New"/>
</body>

This example is for dynamically insert new row and cells in the table. But its behavior is different in all browsers.

  1. Internet Explorer = It add row in the last and new added cells are starts from first.
  2. Chrome/Safari = It add new row in the first and new added cells are starts from end.
  3. Mozilla Firefox = It is not working.

I want new added row in the last and new added cells starts from first like  (Internet Explorer) in all browsers.

If you have any solution for same behavior please tell me.

Remove forced tag
Link
nathanchere
  • 8.1k
  • 15
  • 68
  • 86

dynamically insert new rows in the table (JavaScript) ?

added 134 characters in body; deleted 14 characters in body
Source Link
Reigel Gallarde
  • 65.4k
  • 21
  • 126
  • 142
Loading
Source Link
Karandeep Singh
  • 1.3k
  • 6
  • 22
  • 34
Loading