JavaScript Basics
JavaScript is a programming language that adds interactivity to your website. This happens in games, in the behavior of responses when buttons are pressed or with data entry on forms; with dynamic styling; with animation, etc. This article helps you get started with JavaScript and furthers your understanding of what is possible.
A "Hello world!" example
1. Go to your test site and create a new folder named scripts. Within the scripts folder, create a new text document called main.js, and save it.
2. In your index.html file, enter this code on a new line, just before the closing < /body > tag:
3. This is doing the same job as the < link > element for CSS. It applies the JavaScript to the page, so it can have an effect on the HTML (along with the CSS, and anything else on the page).
4. Add this code to the scripts/main.js file:
5. Make sure the HTML and JavaScript files are saved. Then load index.html in your browser. You should see something like this: