resources
helpful hints - JavaScript

JavaScript is a scripting language most often used for client-side web development. The primary use of JavaScript is to write functions that are embedded in HTML pages and interact with the Document Object
Model (DOM) of the page. Some simple examples of this usage are:
- Opening or popping up a new window with programmatic control over the size, position and 'look' of the new window (i.e. whether the menus, toolbars, etc. are visible).
- Validation of web form input values to make sure that they will be accepted before they are submitted to the server.
- Changing images as the mouse cursor moves over them.
Because JavaScript code can run locally in a user's browser (client side as opposed to server side), it can respond to user actions quickly, making an application feel more responsive. Furthermore,
JavaScript code can detect user actions which HTML alone cannot, such as an 'onClick' or 'onmouseover' event.
Proper JavaScript Declaration
A complete example should look like this:
<script language="JavaScript" TYPE="text/javascript">
<!--
function someName(argument1,agrument2) {
var thisThing = "something";
alert ("This thing is " + thisThing );
alert ("Argument 1 is " + argument1 );
alert ("Argument 2 thing is " + agrument2 );
}
//-->
</script>
Employ <NOSCRIPT> Tag
This is used for browsers that have JavaScript disabled. An example would be:
<NOSCRIPT>
Your browser has JavaScript turned off.
Open your browser preferences and enable JavaScript to enjoy the full features of this page.
</NOSCRIPT>
Prevent Form submission when ENTER is Hit
A commen request, the viewer is filling out a form and on impulse click the Enter key and prematurly submits the form.
Use onkeypress="return enter (document.formname.elementname)" on each form element.
Go Forward, Backword or Reload
<a hre="javaxcript:history.forward(1)">Go Forward One Page</a>
<a hre="javaxcript:history.back(1)">Go Back One Page</a>
<a hre="javaxcript:history.reload(1)">Reload this Page</a>