Methods

When you need to DO something, like open a window, write text to the screen, get the sin of a number, isolate the 1st letter in a word, assign today's date to a variable, send the user back to the previous page, or display an alert box you are using a method.

When you change the details about something which already exists, you are changing its properties.

For example:

document.bgcolor="red"

is a property because I'm changing the existing details about the document. alert("Hello There") is a method because it creates something new, an alert box.

Here are a few types of commands that methods are useful for.

  • Date Methods - set variables to the clock time in a variety of ways.
  • Window Methods - used to open and close new windows
  • Document Methods - Generate new documents on the fly.
  • Form Methods - select form items, send the cursor to text boxes and submit forms.
  • History Methods - Press the reader's 'Back' button and other tricks.
  • Text Methods - Define the look of your text variables before your display them.
  • Math Methods - sin, cos, round, random, absolute value, etc.
  • MessageBox Methods - Alert, Prompt, and Confirm are all methods.

results matching ""

    No results matching ""