HTML Overview Part 5 – JavaScript 1
Scripts 2 Scripts are used to add dynamic content to a web page. Scripts consist of a list of commands that execute without user interaction. JavaScript is code written into your HTML document within script tags: The type attribute in the tag specifies which scripting language is used. // Display a greeting alert(“Hello World”);
Sample Script – Alert Box 3 // Display a greeting alert(“Hello World”);
// Display a greeting alert(“Hello World”); The type attribute in the tag specifies which scripting language is used. 4
// Display a greeting alert(“Hello World”); The type attribute in the tag specifies which scripting language is used. // is used to add a single line comment that explains the script. 5
// Display a greeting alert(“Hello World”); The type attribute in the tag specifies which scripting language is used. // is used to add a single line comment that explains the script. The alert function displays an alert dialog box. 6
// Display a greeting alert(“Hello World”); The type attribute in the tag specifies which scripting language is used. // is used to add a single line comment that explains the script. The alert function displays an alert dialog box. The text to be displayed in the dialog box is in quotation marks. 7
// Display a greeting alert(“Hello World”); The type attribute in the tag specifies which scripting language is used. // is used to add a single line comment that explains the script. The alert function displays an alert dialog box. The text to be displayed in the dialog box is in quotation marks. A semicolon is used to end the JavaScript statement. 8
A message can also be displayed in the status bar of the browser window when your document is loaded. // Display a status bar message window.defaultStatus=“Hello World”; 9
Assignment 10 Work through the W3Schools HTML “How To” tutorial at: and the “Where To” tutorial at: and the “Statements” tutorial at: Complete Practice: Computer viruses – Part 5 of 5 on page 60. Save as lastname_computerviruses5.html