tm 2nd qtr-3ndmeeting(java script-functions)

20
Java Script: Functions Learning by examples: by: Engr. Esmeraldo T. Guimbarda Jr.

Upload: esmeraldo-jr-guimbarda

Post on 04-Jul-2015

129 views

Category:

Internet


1 download

DESCRIPTION

HTML: Javascript(functions)

TRANSCRIPT

Page 1: TM 2nd qtr-3ndmeeting(java script-functions)

Java Script: FunctionsLearning by examples:

by: Engr. Esmeraldo T. Guimbarda Jr.

Page 2: TM 2nd qtr-3ndmeeting(java script-functions)

Activity:1. Open Notepad++. Click on Start > All Programs > Notepad++ folder > Notepad++.

Page 3: TM 2nd qtr-3ndmeeting(java script-functions)

2. Create a new HTML file by clicking File > New, or pressing Ctrl+N on your keyboard.

Page 4: TM 2nd qtr-3ndmeeting(java script-functions)

3. Save the file as “speed.html”.

To save the file, go to File > Save As. Type “speed.html” in the File name box. Select Hypertext Markup Language file in the Save as type selection menu. Save the file in your desktop.

Page 5: TM 2nd qtr-3ndmeeting(java script-functions)

4. Type the basic skeleton code of an HTML document.

Page 6: TM 2nd qtr-3ndmeeting(java script-functions)

5. Define the title as “Speed”.

Page 7: TM 2nd qtr-3ndmeeting(java script-functions)

6. inside the body tag, create a heading <h1> and type “Compute for Speed”.

Page 8: TM 2nd qtr-3ndmeeting(java script-functions)

7. under the heading <h1>, create a table <table> with 2 rows <tr> and 2 columns <td>.

Page 9: TM 2nd qtr-3ndmeeting(java script-functions)

8. In first row <tr>, first column <td>, type in “Distance Traveled”.

In Second row <tr>, first column <td>, type in “Time of Travel”.

Page 10: TM 2nd qtr-3ndmeeting(java script-functions)

9. In first row <tr>, second column <td>. create an input field with input type as text and id as distance.

Page 11: TM 2nd qtr-3ndmeeting(java script-functions)

10. In second row <tr>, second column <td>. create an input field with input type as text and id as time.

Page 12: TM 2nd qtr-3ndmeeting(java script-functions)

11. At the bottom of the table tag </table>, create a button tag <button> linking onclick fucntion to ComputeSpeed.

Page 13: TM 2nd qtr-3ndmeeting(java script-functions)

12. Create a script tag <script> which is inside head tag <head> and below the title tag <title>.

Page 14: TM 2nd qtr-3ndmeeting(java script-functions)

13. Inside the script tag <script>, create the function ComputeSpeed().

Page 15: TM 2nd qtr-3ndmeeting(java script-functions)

14. Initialize variable using distance and time to compute speed.

Page 16: TM 2nd qtr-3ndmeeting(java script-functions)

15. Set the formula to compute for speed.

Page 17: TM 2nd qtr-3ndmeeting(java script-functions)

16. Create an alert to output the value of speed.

Page 18: TM 2nd qtr-3ndmeeting(java script-functions)

17. Save the file by clicking File > Save or pressing Ctrl + S on your keyboard.

Page 19: TM 2nd qtr-3ndmeeting(java script-functions)

18. Open the HTML file to your browser by clicking Run > Lunch in Chrome or Lunch in Firefox on your Notepad++

Page 20: TM 2nd qtr-3ndmeeting(java script-functions)

OUTPUT: