First, we’ll start off with a basic HTML page. Open your editor, and paste in this code:
1 2 3 4 5 6 7 8 9 10
Save this file in a convenient location, like your Desktop, and give it a name ending in
Open the page with Chrome. You can do this by dragging the page into Chrome, or by hitting Command+O (Mac OS X) or Control+O (Windows) and locating the file from there.
You should now see your html page in your browser.
<script> tag inside the
1 2 3 4 5 6
Now, refresh your page, and you should see an alert box pop up and say "hello, world!"
Run on page load
1 2 3 4 5 6 7 8 9 10 11 12 13
Experiment with your page a bit. Here are some suggestions, but feel free to do whatever you’d like:
- Change the message in the alert box
- Alert more than once