Where to Put Your Scripts
Scripts can be put in one of two places on an HTML page: between the <head> and </head> tags (called a header script), or between the <body> and </body> tags (a body script). Script 2.1 is an example of a body script.
There is an HTML container tag that denotes scripts, which, as you would guess, begins with <script> and ends with </script>.
To write your first script:
1. | <script type="text/javascript"> |
2. | document.write("Hello, world!"); |
Get JavaScript and Ajax for the Web: Visual QuickStart Guide, Seventh Edition now with O’Reilly online learning.
O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.