html overview part 5 – javascript 1. scripts 2 scripts are used to add dynamic content to a web...
TRANSCRIPT
HTML OverviewPart 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: <script> </script>
The type attribute in the tag specifies which scripting language is used.
<script type=“text/javascript”>
// Display a greeting alert(“Hello World”);
</script>
Sample Script – Alert Box
3
<script type=“text/javascript”>// Display a greeting alert(“Hello World”);</script>
<script type=“text/javascript”>// Display a greeting alert(“Hello World”);</script>
The type attribute in the tag specifies which scripting language is used.
4
<script type=“text/javascript”>// Display a greeting alert(“Hello World”);</script>
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
<script type=“text/javascript”>// Display a greeting alert(“Hello World”);</script>
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
<script type=“text/javascript”>// Display a greeting alert(“Hello World”);</script>
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
<script type=“text/javascript”>// Display a greeting alert(“Hello World”);</script>
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.
<script type=“text/javascript”>
// Display a status bar message
window.defaultStatus=“Hello World”;
</script>
9
Assignment
10
Work through the W3Schools HTML “How To” tutorial at:http://www.w3schools.com/js/js_howto.asp
and the “Where To” tutorial at:http://www.w3schools.com/js/js_whereto.asp
and the “Statements” tutorial at:http://www.w3schools.com/js/js_statements.asp
Complete Practice: Computer viruses – Part 5 of 5 on page 60. Save as lastname_computerviruses5.html