JavaScript Integration
Is there a lesson on how to incorporate JavaScript code into an html file?
Answer 510debc8cb6718209c0038a2
I’m not sure if there is a full blown lesson, as I’ve not made it all the way through any of the Javascript tracks yet, but have several started.
I do know that it can be done by placing it directly on the page using “script tags” though.
<script>
your code in here
</script>
Or you can use .js files and then link to them in the “head” section of your html document using a src attribute for the script tag:
<script src="myScript.js"></script>
In your file you’d have scripts that do things automatically without needing a function called, or you’d just have a bunch of functions that you could call within a div quickly, like
<div>
<script>
myfunction()
</script>
</div>
if none of that is making sense, then you’d probably better do some of the tracks on here, and get to the basic basics.
The info I gave is not complete, and there are some “better” practice details I certainly left out, but it was just meant to give you some idea of what can and needs to be done, and send you seeking for info in the right direction.
Hope it helps.
Popular free courses
- In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.
- Beginner Friendly.4 Lessons
- Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.
- Beginner Friendly.11 Lessons
- Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.
- Beginner Friendly.6 Lessons