<html><head></head><body>
<input id="name" value="aaaa" onChange="setValue(this, value)">
<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');
}
function setValue(input, value) {
input.setAttribute('value', value);
}
</script></body></html>