Servers likewise have the ability to read other languages in addition to HTML. Some examples are PHP, ASP (Active Server Pages), JSP (Java Server Pages), ColdFusion and others, which are also scripting languages. These languages must be installed on each server.
window.defaultStatus="This is a government site";
Like the Style tag, it is a good idea to place a HTML Comment tag around the script itself but within the start and end Script tags. The only difference between Style and Script tags in this regard is that the double-negative sign at the beginning of the end comment tag has another significance to most scripting languages, therefore you must insert script comment indicators (which for many languages are double hash marks: // ) before the end Comment tag, as shown above.
Recall that the Head section of HTML files house information the computer uses to prepare the display while the Body section houses what is displayed. Some scripts are split in two--part of the script goes in the Head section, and part of it goes in the Body section.
A word of caution with scripts: copy exactly as you find the script! Do not add any spaces, or line breaks, or punctuation, or anything else. Scripting languages are not as forgiving as HTML. A common error is to copy a script, and since the script is one long line of commands and text that runs off the page, the unwary designer inserts a carriage return here and there so it is easier to read, then the script will not run.Here are some sample scripts:
- Moving Blocks
- Header Color Change
- Fade In!
- Click Me
- Count Days
- Form Links
- Find Coordinates
- Text Tricks
- Button Tricks
A CAVEAT: Hackers can use any one of a number of ways to insert destructive scripts into your pages when they are sent to clients. See this site for examples and more information. You, as the webmaster, can minimize this threat, but not eliminate it. The only way to eliminate the threat is for the client to disable scripting on their own browser. If this is done, none of your scripts (including your event handlers such as onclick) will work. Most clients prefer to have the advantages of scripting enabled, but given the current state of affairs, DoD clients may not be given a choice.
In that case, you may want to go to Plan B, and use Noscript tags. Similar to Noframe tags, anything between <noscript></noscript> is ignored by the browser if scripting is enabled. If scripting is disabled, the Noscript tags go to work.
Of course, there are other ways hackers can do damage, so eliminating scripts from your design will not eliminate your problems altogether.
- In this lesson, we learned about these HTML tags:
- <script> and </script>
- <noscript> and </noscript>
- and about these Event Handlers:
- onmouseover and