方法

open()和close()方法

open()方法用以開啟一個新網頁,close()方法用以結這個網頁。
<html>
<head>
<SCRIPT language="JavaScript">
<!--
function newpage()
{
    var thename=document.myform.yourname.value;
    document.open();
    document.wirte("<h1>Welcome!</h1>");
    document.wirte("Hello, " + thename + ", and welcome to my page!);
    document.close();
}
//-->
</SCRIPT>
</head>
<body>
<b>Enter your name in the box below, then click the button to see a personalized page!</b>
<p>
<form name="myform">
Name: <input type="text" name="Your name" size="25">
<p>
<input type="button" value="Click" onClick="newpage();">
</form>
</body>
</html>

write()方法

writeln()方法