<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>hello</title>
<meta name="generator" content="Studio 3 http://aptana.com/">
<meta name="author" content="Administrator">
<!-- Date: 2011-08-08 -->
<script type="text/javascript" language="JavaScript">
/* 页面输出2行write内容 */
function hello() {
var w = window.open();
var d = w.document;
d.open();
d.write("<h1>Hello world!</h1>");
d.write("<h1>Hello world2!</h1>");
d.close();
}
/* 页面输出一条write内容(后者) */
function hello2() {
var w = window.open();
var d = w.document;
d.open();
d.write("<h1>Hello world!</h1>");
d.close();
d.write("<h1>Hello world2!</h1>");
}
</script>
</head>
<body>
<button οnclick="hello()">hello</button>
<button οnclick="hello2()">hello</button>
</body>
</html>
第一种情况
Hello world!
Hello world2!
第二种情况
Hello world2!