I have this code
When you load the page you will have to collect all the values in a javascript array
var defaults = new Array();
var elements;
window.onload = function(){
elements = document.getElementsByTagName("input");
for (i=0; i
and return to defaults when the button cancel is clicked
var cancel = document.getElementById('cancel');
cancel.onclick = function() {
for(i=0; i
Edit: for reset button you can use
Edit 2: if you want to reset only the value if the input c you can use this:
var cancel = document.getElementById('cancel');
cancel.onclick = function() {
for(i=0; i