<html>
<head>
<title>测试文档</title>
</head>
<body>
<p>
文档标题为:
<script type=
"text/javascript"
>
document.write(document.title)
</script>
</p>
</body>
</html>
运行该例子输出:文档标题为: 测试文档