It doesn't work because it's invalid HTML:
document.write("</form><button ... onclick='Proceed('test')'>...</button>");
Will be written as:
</form><button ... onclick='Proceed('test')'>...</button>
When it's written to the DOM, the quoting style of onclick
dictates where it ends, essentially making the value of onclick
Proceed(
. You need to change your quoting characters:
document.write("</form><button ... onclick=\"Proceed('test')\">...</button>");
or:
document.write("</form><button ... onclick='Proceed(\"test\")'>...</button>");
Edit: See this plunkr for a simple example