Add an automate it script  Hot PDF Print E-mail
Tag it:
Delicious
Furl it!
Digg
NewsVine
Reddit
YahooMyWeb
Technorati
Articles Reviews XHTML
Written by Bogdan V   
Tuesday, 27 February 2007


{mos_sb_discuss:22}

Scripts are little programs that add interactivity to your page. You can write simple scripts to add an alert box or a bit of text to your page, or more complicated scripts that load particular pages according to your visitor's browser or change a frame's background color depending on where they point the mouse.


 

Most scripts are written in JavaScript, since JavaScript is the scripting language that is supported by most browsers, including Netscape and Explorer.

Adding an "Automatic" Script

There are two kinds of scripts—those that are executed without the visitor having to do anything and those that react to something the visitor has done. The first group might be called "automatic scripts" and are executed by the browser when the page is loaded.

To add an automatic script:

1. In your (X)HTML document, type
2. Type type="text/language-name", where language-name identifies the scripting
language you're using: javascript, vbscript, etc.
3. Type language="script", where script is the name of the scripting language you'll be
using: JavaScript, VBScript, etc.
4. Type >.
5. Type the content of the script.
6. Type .

Note: A script may appear anywhere in your (X)HTML document, however, where it appears determines when it will be executed.e Scriptsbr />
document.write("Visca Catalunya!")



Here's the rest of the page.


Note: This simple JavaScript script is output to the browser window itself. Other scripts send their results elsewhere.

The language attribute is deprecated and thus only valid in (X)HTML transitional. Nevertheless it is often used to maintain compatibility with older browsers.

The location of the script on the (X)HTML page determines when it will load. Scripts are loaded in the order in which they appear in the (X)HTML file. If you want your script to load before anything else, be sure to place it in the h section.


User reviews

There are no user reviews for this item.

Add new review




Powered by jReviews

Last Updated ( Thursday, 07 June 2007 )
 
< Prev   Next >