A very simple example of the input and creation of a CSV file is as follows.
You would need to copy and past the output of the script to a NotePad or WordPad (or similar) application
so you could save the information for the Excel file to read.
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title> Untitled </title>
<script type="text/javascript">
</script>
<style type="text/css">
#entryForm { list-style-type: none; }
</style>
</head>
<body>
<ul id="entryForm">
<li> <input type="text" value="" name="info"> Firstname </li>
<li> <input type="text" value="" name="info"> Middlename </li>
<li> <input type="text" value="" name="info"> Lastname </li>
<li> <input type="text" value="" name="info"> State </li>
<li> <input type="text" value="" name="info"> Phone </li>
</ul>
<br><input type="button" value="Clear inputs" onclick="clearEntry('entryForm')">
<input type="button" value="Create records" onclick="createRecord('entryForm','CSVinfo')">
<input type="button" value="Clear records" onclick="document.getElementById('CSVinfo').value=''">
<p><textarea id="CSVinfo" rows="10" cols="70"></textarea>
<script type="text/javascript">
function clearEntry(IDS) {
var sel = document.getElementById(IDS).getElementsByTagName('input');
for (var i=0; i<sel.length; i++) { sel[i].value = ''; }
}
function createRecord(entryInfo,outputInfo) {
var tarr = [];
var sel = document.getElementById(entryInfo).getElementsByTagName('input');
for (var i=0; i<sel.length; i++) { tarr.push(sel[i].value); }
document.getElementById(outputInfo).value += '"'+tarr.join('","')+'"\n'; // could also use ";" as separator
}
</script>
</body>
</html>
Bookmarks