Calendar applet, calling javascript function |
What does this example show ?
This example shows how to call a javascript function from the applet.
Our function is named alertDate();
The applet provides 3 functions that can be called from a javascript function.
- GetYear(), return an integer representing the year
- GetMonth(), return an integer representing the month
- GetDay(), return an integer representing the day in the month
Example |
|
Click on a day to call the function alertDate().
Don't forget to add the keyword MAYSCRIPT if you want the applet to call the function.
<applet
code=ccalendar.class
name=ccalendar MAYSCRIPT
width=160
height=160
id = "cal">
<param name="color_fond" value="CCCCFF">
<param name="color_case" value="C0C0FF">
<param name="color_Comment" value="AAAAFF">
<param name="color_empty" value="9090FF">
<param name="jvf" value="alertDate()">
</applet>
function alertDate()
{
alert("Year = "+document.ccalendar.getYear()+", month="+document.ccalendar.getMonth()+", day="+document.ccalendar.getDay());
}