To include a JavaScript file on a webpage, insert a <script> tag:
<!DOCTYPE html>
<html>
<head>
<title>My Page</title>
<script src="test.js"></script>
</head>
<body>
Hi, here is some text.
</body>
</html>
where test.js file is a text file with some JavaScript in it, e.g.:
alert('hi there');
Leave a comment