Presentation is loading. Please wait.

Presentation is loading. Please wait.

Writing a JavaScript User-Defined Function  A function is JavaScript code written to perform certain tasks repeatedly  Built-in functions.

Similar presentations


Presentation on theme: "Writing a JavaScript User-Defined Function  A function is JavaScript code written to perform certain tasks repeatedly  Built-in functions."— Presentation transcript:

1 Writing a JavaScript User-Defined Function  A function is JavaScript code written to perform certain tasks repeatedly  Built-in functions

2 Writing a JavaScript User-Defined Function  User-defined functions  Written by the Web developer  Functions can have data passed to it  To call a function means to have JavaScript execute the function

3

4

5 Entering the chngSite() User-Defined Function in the HEAD Section  Click the blank line (line 4) between the end tag and the end tag

6 Type and then press the ENTER key. Type <!—Hide from old browsers and then press the ENTER key

7 Entering the chngSite() User-Defined Function in the HEAD Section  Press the SPACEBAR four times. Type function chngSite() { and then press the ENTER key. Press the SPACEBAR eight times. Type alert(“You are about to be transported to the new site location!”) and then press the ENTER key. Press the SPACEBAR eight times. Type location = “http://www.scsite.com/” and then press the ENTER key. Press the SPACEBAR four times. Type } and then press the ENTER key. Type //-> and then press the ENTER key. Type and then press the ENTER key

8

9 Saving the File  Click Save on the File menu

10 Testing the Web Page  Click the Fun with Phonics button on the taskbar  Click the Refresh button on the browser toolbar  If you are connected to the Internet, click the OK button when the dialog box displays with the alert message  Click the Back button on the browser toolbar to return to the Fun with Phonics Web page

11

12

13 Printing the HTML File Using Notepad  If necessary, click the Notepad button on the taskbar. Click File on the menu bar and then point to Print

14 Click Print

15

16 Closing Notepad and Your Browser  Click the Close button on the browser title bar  Click the Close button on the Notepad window title bar

17 Summary  Discuss how to integrate JavaScript with HTML  Insert tags on a Web page  Write start and end tags  Define and use flickering to draw attention  Describe the background color property of the document object

18 Summary  Set the background color of a Web page using JavaScript  Save the HTML file  Test the Web page  Discuss JavaScript variables  Extract the system date  Use several variables to construct a message

19 Summary  Describe the write() method of the document object  Write a user-defined function that displays a message and links visitors to a new Web site  Describe how the setTimeout() method works  Use the lastModified property to display the last modified document date  Print an HTML Notepad file

20 What You Should Know

21 Project 8 Complete PLEASE REVIEW FOR EXAM!


Download ppt "Writing a JavaScript User-Defined Function  A function is JavaScript code written to perform certain tasks repeatedly  Built-in functions."

Similar presentations


Ads by Google