Your browser does not support JavaScript!
Upvotes Anonymous 0 User 1

How to Include a JavaScript File

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');
Was this helpful?

Comments

Leave a Comment

I agree to the Terms of Service
Design © 2015, Downranked, LLC.,
Original user code contributions under MIT License