This should work -
HTML Code:
<html>
<head>
<script type="text/javascript">
<!--
function writer() {
var txt = document.getElementById("intro").value;
document.write("<html><head><title>Hi</title></head><body>");
document.write(" " + txt + " ");
document.write("</body></html>");
}
//-->
</script>
</head>
<body>
<input type="text" value="bob" id="intro">
<button onclick="writer()">Test</button>
</body>
</html>
There were a couple of problems -
HTML Code:
document.write("</body></html>
should look like this
HTML Code:
document.write("</body></html>");
Also, you named your function write(). I don't think you can name a function write so I renamed it writer() and it worked fine in IE (May be different in Firefox...).
Keyboard1333
Bookmarks