Friday, 20 February 2015

Week 36: February 16-20 It seems easy!

 Hi!

 We did another exercise! I did't enter to our class in ICT because I took the exam in Mapeh. We create a function called changeColor() that will be called when the user presses one of two buttons. The first button will contain the text "Press here for a yellow background". The second button will contain the text "Press here for a light green background". The function will take one parameter, a color. Its function is to change the background color of the current document.



A JavaScript function is a block of code designed to perform a particular task.
A JavaScript function is executed when "something" invokes it (calls it).
A JavaScript can be executed when an event occurs, like when a user clicks on an HTML element.
To execute code when a user clicks on an element, add JavaScript code to an HTML event attribute:
Examples of HTML events:
  • When a user clicks the mouse
  • When a web page has loaded
  • When an image has been loaded
  • When the mouse moves over an element
  • When an input field is changed
  • When an HTML form is submitted
  • When a user strokes a key
 The onClick event executes a JavaScript when a button is clicked.  


Taken from http://www.w3schools.com/js/js_htmldom_events.asp.

0 comments:

Post a Comment

// Posted by :Unknown // On :Friday, 20 February 2015

 Hi!

 We did another exercise! I did't enter to our class in ICT because I took the exam in Mapeh. We create a function called changeColor() that will be called when the user presses one of two buttons. The first button will contain the text "Press here for a yellow background". The second button will contain the text "Press here for a light green background". The function will take one parameter, a color. Its function is to change the background color of the current document.



A JavaScript function is a block of code designed to perform a particular task.
A JavaScript function is executed when "something" invokes it (calls it).
A JavaScript can be executed when an event occurs, like when a user clicks on an HTML element.
To execute code when a user clicks on an element, add JavaScript code to an HTML event attribute:
Examples of HTML events:
  • When a user clicks the mouse
  • When a web page has loaded
  • When an image has been loaded
  • When the mouse moves over an element
  • When an input field is changed
  • When an HTML form is submitted
  • When a user strokes a key
 The onClick event executes a JavaScript when a button is clicked.  


Taken from http://www.w3schools.com/js/js_htmldom_events.asp.

Leave a Reply

Subscribe to Posts | Subscribe to Comments

 

Blog Template by YummyLolly.com - Header made with PS brushes by gvalkyrie.deviantart.com
Sponsored by Free Web Space