<!--方法一:通过外部源文件来包含javascript,这是最正确的方式,把结构从行为中分离出来-->
<head>
    <script type=”text/javascript”src=”source.jsp”></script>
</head>

<!--方法二:在<head>中包含js代码-->
<head>
    <script type=”text/javascript”>
        //JavaScript代码
    </script>
</head>

<!--方式三:把嵌入式的脚本添加到文档的<body>中,维一的理由是要使用document.write()方法,但我们有更好方法来替代他。如:createElement()方法, appendChild()方法, 非EMCAscript标准的 innerHTML属性-->
<body>
    <script type=”text/javascript”>
        document.write(“html....”);
    </script>
</body>

<!--方式四:非官方EMCA标准的 javascript:前缀 ;可以成功打开一个新的窗口-->
<a href="javascript:window.open('http://www.google.com');" >进入</a>