Java, developed under the Sun Microsystems brand, is a full-fledged object-oriented programming language. It can be used to create standalone applications and a special type of mini application, called an applet. Applets are downloaded as separate files to your browser alongside an HTML document, and provide an infinite variety of added functionality to the Web site you are visiting. The displayed results of applets can appear to be embedded in an HTML page (e.g., the scrolling banner message that is so common on Java-enhanced sites), but the Java code arrives as a separate file.
Variables defined outside a function are global in scope and can be accessed from any function in the document. Variables defined inside a function are local in scope and created and destroyed with function execution. Local variables can only be accessed from within the function they are defined.
The number of elements in the array can be determined using the 'length' attribute of the array variable.
|5 Events||back to ToC|
|OnBlur||Occurs when an object looses focus|
|OnClick||Occurs when the mouse clicks on the object|
|OnDblClick||Occurs when the mouse double-clicks on the object|
|OnFocus||Occurs when the object gets focus. Either by mouse click or keyboard shortcut, or tabbing|
|OnKeyDown||Occurs when any key is pressed, on the down-stroke.|
|OnKeyPress||Occurs when any key is pressed, on the up-stroke.|
|OnKeyUp||Occurs when any key is pressed, on the up-stroke.|
|OnMouseDown||Occurs when the mouse key is pressed, on the down-stroke.|
|OnMouseUp||Occurs when the mouse key is pressed, on the up-stroke.|
|OnMouseOver||Occurs when the mouse's position is moved over the object|
|OnMouseOut||Occurs when the mouse's position is moved off of the object|
|OnMouseMove||Occurs when the mouse is moved.|
|onSubmit||The onsubmit event occurs when a form is submitted. It only applies to the FORM element.|
|onReset||The onreset event occurs when a form is reset. It only applies to the FORM element.|
|onSelect||The onselect event occurs when a user selects some text in a text field. This attribute may be used with the INPUT and TEXTAREA elements.|
|onChange||The onchange event occurs when a control loses the input focus and its value has been modified since gaining focus. This attribute applies to the following elements: INPUT, SELECT, and TEXTAREA.|
Below is an example of browser event processing:
|6 Conditional Constructs||back to ToC|
|8 Building and Testing Your Forms||back to ToC|
If you are building a form and want to test it you can use my FormTest.jsp. This JSP will display the parameters your form sent, and allow you to examine how various form elements submit information. The URL of the form tester is:http://www.profiler.noaa.gov/jsp/FormTester.jsp
Open an Example form to see how it works.
|9 Identifying and Fixing Programming Errors||back to ToC|
If you double-click on the icon, a detailed error message dialog is displayed as shown below. The message box will indicate the offending line number, and you can go back to your source code a fix the error.
The Dynamic Form Example has a bug in this code, for some home work, why don't you try to figure out what the bug is and how to fix it!
Form field validation allows the client application to check for gross-error in a form's data prior to submitting the data to the server. To keep things short, lets look at a simple example of form validation.