bbb Home
JavaScript Functions Contents        

DEFINING AND CALLING FUNCTIONS

SAMPLE FUNCTION DEFINITION

function FunctionName() {

Code goes here

}


EXAMPLE

Font: 8pt   12pt   20pt   24pt   Width: Min. 50%   75%   100%   

PRACTICE

  1. Write a function that displays prompts the user for a word and then sets the title of the document and the status bar to the word. Call the function from an onclick event for a button.
  2. Create a page with two textboxes. Create a function that swaps the contents of the textboxes. Hint - you should store the innerHTML of one of the textboxes in the status bar or another element.

SELF-QUIZ