Reputation:
I would like to add a new row to my HTML table and delete the row dynamically using VBScript. Iam new to this can anyone guide me how to do this.
Upvotes: 1
Views: 2269
Reputation: 890
Note that this will be Internet Explorer specific. Might not work on other browsers/
Sub AddRow()
Dim objTable : Set objTable = window.document.getElementById("tableid")
Dim objRow : Set objRow = objTable.insertRow()
Dim intCount, objCell
For intCount = 0 To 2
Set objCell = objRow.insertCell()
objCell.innerHTML = "Content for cell")
Next
End Sub
For delete use
window.document.getElementById("tableid").deleteRow(oRow.rowIndex);
Upvotes: 1