I'd like to show you that applets can be controlled from JavaScript. This timezone clock applet has a settimezone(String offset_in_minutes) method which can be used in JavaScript, like in the example I created a HTML form to choose a timezone, and wrote a simple script which evoked the applet settimezone method, when you chose timezone. By the way, if you decide to host that applet on your pages, you can choose any size for that clock you want, changing WIDTH and HEIGHT statements of applet tag.
tzclock.class Java applet ----> |
|
HTML form and JavaScript functions ----> |
|
Choose timezone in HTML choice form, and look how it interacts with applet. |
Name: | Value: |
AUTHOR | "Maxim V. Kollegov (Virtual_Max, http://www.geocities.com/siliconvalley/lakes/8620)" obligatory parameter for free applet.. |
BGIMAGE | Optional parameter for page background image. only JPG and GIF formats supported. This and other colors should be in hexadecimal format without any format symbols i.e. for red color value it should be "FF0000" |
BGCOLOR | OR Optional parameter for Applet solid color background if BGIMAGE parameter is not specified. |
COLOR | Main drawing color |
DCOLOR | Optional Dark color for shadows, if that parameter isn't specified, no shadows will be drawn |
LCOLOR | Optional Light color for shining parts, if not specified no shining parts will be drawn |
settimezone(String timezoneoffset_in_minutes)
This method set time zone offset (in
minutes). For example for EST (GMT -5:00) this value should be "-300"
Can be called from JavaScript
String getlocaltimezone() that applet method return local timezone, in minutes. Assuming that DLST lasts from last Sunday of march to last Sunday of September in most of countries, this method obtains the local time zone offset from system and calculates the timezone. I'll try to illustrate this. Java and Java script methods getTimezoneOffset() return offset including DLST, for EST -5:00. This methods return -4:00 in summer and -5:00 in winter, meanwhile getlocaltimezone() method always return -5:00 for EST timezone.
setclocktitle(String title) method allows you to change title on the clock face dynamically.
<APPLET NAME=clock CODE=tzclock.class WIDTH=200 HEIGHT=200> <PARAM NAME="AUTHOR" VALUE="Maxim V. Kollegov (Virtual_Max, http://www.geocities.com/siliconvalley/lakes/8620)"> <PARAM NAME="BGIMAGE" VALUE="gold1.gif"> <PARAM NAME="BGCOLOR" VALUE="000000"> <PARAM NAME="COLOR" VALUE="A0A000" > <PARAM NAME="DCOLOR" VALUE="606000"> <PARAM NAME="LCOLOR" VALUE="C0C000"> </APPLET>
Assuming you used name=clock as in above tag, you can call applet methods as following
<SCRIPT> function SetMoscowTime() { document.clock.setclocktitle("Moscow Time"); document.clock.settimezone("+240"); } </SCRIPT>