---
# System prepended metadata

title: Javascript
tags: [javascript]

---

---
tags: javascript
description: Javascript Tutorial 
---
# Javascript
In this page, I'm going to share some function and problem solving method that often occured in every daily life of a software programmer.

## Q: Add Table dynamically?
> **A**: 

```gherkin=
<button class="btnaddParameter" onclick="addParameter('','')">+</button><br>
<button onclick="updateMR()">Update</button><br>
```

```gherkin=
function addParameter(v1, v2){
	var tableParam = document.getElementById("TableMR");
	var row = tableParam.insertRow(-1);
	row.align="left";
	row.insertCell(0).innerHTML = '<input type="text" value="' + v1 + '">';
	row.insertCell(1).innerHTML = '<input type="text" value="' + v2 + '">';
	row.insertCell(2).innerHTML = '<button onclick="delParam(this)">delete</button>';
}		
```

```gherkin=
function delParam(row){
	var index= row.parentNode.parentNode.rowIndex;
	var tableParam = document.getElementById('TableMR');
	var count = tableParam.rows.length;
	tableParam.deleteRow(index);
}
```