<html><head></head><body>
<input id="name" value="aaaa">
<input id="type" value="bbbb">
<a href="#" onclick="downloadHTML()">Download HTML</a>
<script>
function downloadHTML() {
var anchor = document.querySelector('a');
anchor.setAttribute('href', 'data:text/html;charset=UTF-8,' + encodeURIComponent(document.documentElement.outerHTML));
anchor.setAttribute('download', 'index.html');
}
var inputs = document.getElementsByTagName("input");
for (var i = 0; i < inputs.length; i++) {
inputs[i].addEventListener("change", function(ev) {
var input = ev.target;
input.setAttribute("value", input.value);
});
}
</script></body></html>