|
JavaScript programs are lines of code written in plain text that are placed
inside an HTML page. JavaScript can be written to run unattended - modifying
the content of a web page and creating in-page animations. JavaScript can
also be written to run as a response to events - such as a mouse click by the user.
The <script> and </script> HTML tags are used to enclose
JavaScript code.
As the browser reads an HTML page, it executes any JavaScript code as it is
read - with the exception of JavaScript functions which are run only when
called (more on this later).
JavaScript programs can modify the content of a web page (text or images) but for security
reasons are constrained from making any changes to the users PC. JavaScripts may not read/write files
on the user's PC, cannot access user information nor send user information over the Internet.
HTML pages may contain multiple scripts. Variables created in one script are available to
all other scripts on the page.
Generally, JavaScript is placed in the head of a page but JavaScript can actually be used
in several different ways inside an HTML file:
- Inline code (placed within <script> and </script> tags)
- Event handlers (within other HTML tags, used to handle the web page response to a user event, such as clicking)
- Replacement of attribute values (such replacing the URL value of the href attribute)
Some of the many uses of JavaScript include:
Navigation
- Display a frame in its own window
- Display popup messages
- Display popup windows
- Display hyperlinked menus
- Change status bar content
- Email a page to a visitor
- Disable use of right mouse click
User Information
- write/read cookies
- browser ID
- determine screen size
Web Sites
- create a guestbook
- bookmark a page
- add URL to favorites
- send URL to a friend
- count # of visits
- get user IP address
- print this page
|      
|
Applications
- clock
- calendar
- calculation
- color picker
- ramdom message
Visual Effects
- mouseovers
- slideshow
- animation
- images
- watermark
- banners
- background images
- text effects
- mouse cursors
Games/Humor
- Moving eyes
- Bouncing balls
Security
|
|