Java Scrip #3
Read a data file from the server
Read an HTML page from the server in a variable
Display a page from a variable
Detect browser type
and version
Detect user
resolution
Remove control
characters from a string
Remove all token
occurrences from a string
Replace a token by
another in a string
Have year on 4
digits from a Date object
Validate an email
address
Trigger a submit
with Enter
Do simple animation
Print the current
page
Validate a date
Detect if a window
is already opened
Easily handle
parameters in the search part of a URL
Read a data file from the server
[N4 or better]
The data file for demonstration
[data.txt] one two three four five |
Read an HTML page from the server in a variable
[N4 or better]
After pressing the button, wait a few seconds while the page is read, then an Alert box
containing the page content will appear, if the Alert box is bigger (probably) than the
screen, just press ENTER to close it. Display a page from a variable
|
Detect browser type and version
For more complete script to detect browser version, check the
Netscape site Detect user resolution
|
Remove control characters from a string
|
Remove all token occurrence from a string
|
Replace a token by another in a string
|
Have year on 4 digits from a Date object
|
Validate an email address
It's impossible to check if an address is REALLY valid but we can check for the presence
of the "@" character.
Press ENTER to validate this email address
Trigger a submit with Enter
The trick is to use 2 forms. The first one contains all the fields except the last one.
The second form contains the last field and in the submit function, we read the values
from the first form and put them in hidden fields defined in the second form. After
validation, the submit function returns true or false to submit or not.
Do simple animation
To change an image when clicking on it :
Finally changing an image when moving the mouse on it :
Print the current page
For Netscape 4 only.
Validate a date
test date
Detect if a window is already opened
Easily handle parameters in the search part of a URL
12/04/99