-----------------内嵌式----------------
hello.html文件:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>内嵌式</title>
</head>
<body>
<script type="text/javascript">//javascript引入方式:嵌入式
alert("hello");//输出语句
</script>
<script>
console.log(3 + 4);//控制台输出,并不在页面显示
console.log(3 == 4);
</script>
</body>
</html>
--------------------------------外链式---------------------------------------
hello1.html文件:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>外链式</title>
</head>
<body>
<script src='test.js'></script>
</body>
</html>
test.js文件:
document.write("外链式test");//注意:该输入方式会清空页面内容(?)
-----------------------------------行内式-----------------------
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>行内式</title>
</head>
<body>
<a href="javascript:alert('行内式test');">test</a>
</body>
</html>