第一种:引用外部的js文件
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="keywords" content="html,js,css" />
<script src="common.js" charset="UTF-8"></script>
</head>
<body> </body>
</html>
其中common.js文件里面的内容为:
document.write("woshi好人");
第二种:在html中编写js代码
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="keywords" content="html,js,css" />
<script type="text/javascript" charset="UTF-8">
document.write("woshi好人");
</script>
</head>
<body> </body>
</html>
<script>的属性: