|

A review of basic syntax rules and definitions
- Variable
- Placeholder to store defined data
- Can hold a value assigned by program
- Assign values as strings (in quotes) or numeric
- Properties
- Specific values assigned to variables
- Concantenate
- Combine string values together with +
- Functions
- Program instructions to accomplish a task
- Must be invoked from within program
- Good for repetitive tasks
- Object
- Collection of variables and functions
- Together carry out task
- Methods are functions for the object
- Properties are variables for the object
An example of an object is a restaurant menu. Variables or properties include the various dishes offered, the prices, the category - appetizer, main course, dessert, etc. The functions or methods compute the total price of the meal, tax, tip, etc. Another example might be a web page menu with various preferences making up the properties The functions, based upon the user's choice, would redirect to an appropriate web page - i.e., travel, sports, or music.
Browser Detection
The Navigator object in Javascript-
- appName - name of current browser
- appVersion - browser version
- appcodeName - usually Mozilla
- platform - operating system
- userAgent - one line summary
*Note: Names are case-sensitive.
Redirection is one use for browser detection.
The script for userAgent is included here -
ME seems to report Windows 98 - hmmm.
|
|