I have created a html form which has text(name and contact num) and table.
Problem i have to save and retrieve the data which is entered in those fields in a simple text/csv file using javascript.
Can any one help me out with this?
<html>
<head>
<title>Assignment</title>
<script>
function addRow()
{
var qualific = document.getElementById("Qualification");
var percent = document.getElementById("Percentage");
var year = document.getElementById("yop");
var univers = document.getElementById("university");
var table = document.getElementById("dataTable");
var rowCount = table.rows.length;
var row = table.insertRow(rowCount);
row.insertCell(0).innerHTML = '<input type="text" id="Qualification">';
row.insertCell(1).innerHTML = '<input type="NUMBER" id="Percentage">';
row.insertCell(2).innerHTML = '<input type="NUMBER" id="yop">';
row.insertCell(3).innerHTML = '<input type="text" id="university">';
}
//delete row
function deleteRowEd(r) {
var i = r.parentNode.parentNode.rowIndex;
document.getElementById("dataTable").deleteRow(i);
}
function myFunctionEd() {
alert("Are you sure you want to delete this row?");
}
</script>
</head>
<body>
<p class="first"><b> Name:</b> *
<input type="text" name="firstname" style="text-transform: capitalize" required placeholder="Enter a valid name" />
</p>
<b> Contact Number:</b> *
<input type="text" name="pcn" required placeholder="Enter a valid number" onblur="validatenumber(this);" onkeypress="return onlyNos(event,this);" size="6" maxlength="10" />
</br>
</br>
<b>Education Details:</b>
<table id="dataTable" border="1" style="width:50%;text-align:center;">
<tr>
<td><b>Qualification<b></td>
<td><b>Percentage</b>
</td>
<td><b>Year of Passout</b>
</td>
<td><b>University</b>
</td>
<td></td>
</tr>
<tr>
<td>
<input type="text" id="Qualification">
</td>
<td>
<input type="number" id="percentage">
</td>
<td>
<input type="number" id="yop">
</td>
<td>
<input type="text" id="university">
</td>
</tr>
<tr>
<td>
<input type="text" id="Qualification">
</td>
<td>
<input type="number" id="percentage">
</td>
<td>
<input type="number" id="yop">
</td>
<td>
<input type="text" id="university">
</td>
</tr>
<tr>
<td>
<input type="text" id="Qualification">
</td>
<td>
<input type="number" id="percentage">
</td>
<td>
<input type="number" id="yop">
</td>
<td>
<input type="text" id="university">
</td>
</tr>
</table>
<br>
</body>
</html>