Thursday, April 30, 2009

For using javascript Calendar in web page


1. To use calendar in our page, we should include one JS file in our project on the same path of our page.
2. Paste the following line in <head>

<SCRIPT LANGUAGE="JavaScript" SRC="CalendarPopup.js"></SCRIPT>

<SCRIPT LANGUAGE="JavaScript" ID="js1">
var cal1 = new CalendarPopup();
</SCRIPT>

3. Paste the following two lines where you want to show calendar and inside <body>

<INPUT TYPE="text" NAME="date1" VALUE="">
<A HREF="#" onClick="cal1.select(document.forms['frmCal'].date1,'anchor1','yyyy-MM-dd'); return false;" TITLE="); return false;" NAME="anchor1" ID="anchor1">select</A>

4. Here I use the name of the form (frmCal). Instead of that you can use the form number of that form. Suppose that is the first form then the form number should be zero.

Remember to give proper unique name for anchor tags and for text boxes to use multiple calendars in same form.

More Articles...

No comments:

Search This Blog