将JS嵌入到网页中的不同方式—从外部引入(二)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_36282409/article/details/86561126
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>javascript基础</title>
</head>

<body>
<h3>javascript基础:引入javaacript</h3>
<script type="text/javascript" src="js/myjs.js">
//从外部引入js文件;
</script>
</body>
</html>

新建一个js文件,如:
// JavaScript Document

alert("helloworld");

猜你喜欢

转载自blog.csdn.net/weixin_36282409/article/details/86561126