JavaScript Placement
JavaScript can be placed in the and the sections of an HTML page. The tags. Example Older examples may use a type attribute: My Web Page A Paragraph Try it JavaScript in In this example, a JavaScript function is placed in the section of an HTML page. The function is invoked (called) when a button is clicked: Example My Web Page A Paragraph Try it It is a good idea to place scripts at the bottom of the element. This can improve page load, because HTML display is not blocked by scripts loading.External JavaScript Scripts can also be placed in external files. External scripts are practical when the same code is used in many different web pages. JavaScript files have the file extension .js. To use an external script, put the name of the script file in the src (source) attribute of the You can place an external script reference in or as you like. The sc...