Display textfield value in new page
<html>
<head>
<title>Welcome Page</title>
<script type="text/javascript">
function rewritePage(form) {
var newPage = "<html><head><title>Page for ";
newPage += form.entry.value;
newPage += "</title></head><body>";
newPage += "<h1>Hello, " + form.entry.value + "!</h1>";
newPage += "</body></html>";
document.write(newPage);
document.close();
}
</script>
<body>
<h1>Welcome!</h1>
<hr>
<form onsubmit="return false;">
<p>Enter your name here: <input type="text" name="entry" id="entry"></p>
<input type="button" value="New Custom Page" onclick="rewritePage(this.form);">
</form>
</body>
</html>
Related examples in the same category