html overview part 5 – javascript 1. scripts 2 scripts are used to add dynamic content to a web...

10
HTML Overview Part 5 – JavaScript 1

Upload: augustine-welch

Post on 21-Jan-2016

229 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 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

HTML OverviewPart 5 – JavaScript

1

Page 2: 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

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>

Page 3: 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

Sample Script – Alert Box

3

<script type=“text/javascript”>// Display a greeting alert(“Hello World”);</script>

Page 4: 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

<script type=“text/javascript”>// Display a greeting alert(“Hello World”);</script>

The type attribute in the tag specifies which scripting language is used.

4

Page 5: 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

<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

Page 6: 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

<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

Page 7: 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

<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

Page 8: 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

<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

Page 9: 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

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

Page 10: 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

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