Click here to Skip to main content
15,867,686 members
Articles / Programming Languages / Javascript
Article

Easy Calendar

Rate me:
Please Sign up or sign in to vote.
3.61/5 (15 votes)
20 Oct 2004 86.9K   1.8K   23   10
An article that demonstrates a simple yet very powerful Calendar, no need for server-side hussle!

Introduction

Ever had a form where you wanted the user to fill-in a date, a valid date? Tried and looked for something to help you out? EasyCalendar is for you!

Using the code

Plain simple: put the EasyCalendar files (except for demo.html - included in the project zip) in your Web/HTML directory, and make very modifications to your original HTML file (it can be ASP, ASP.NET, PHP whatever...) as demonstrated in the demo.html.

The Javascript code will be like:

JavaScript
<script language="javascript">
var activeElement = false;
function setDate( elementName )  {
  activeElement = document.forms[0].elements[ elementName ];
  var w = window.open("DateSelector.html", "DateSelector",
    "width=280,height=280,resizable=no,scrollbars=no,
    menu=no,location=no,status=no");
  w.focus();
}
function GetDateSelectorDate() { return activeElement.value; }
function SetDateSelectorDate( dateString )
 { activeElement.value = dateString; }
</script>

And supposing you have an <input name="date1" readonly="yes"> where you need to set a valid date, just make an anchor with a javascript event, ex: <a href="javascript:setDate('date1')">Change the date</a> and that's it!

Enjoy!

Conclusion

I have fun making tools in JavaScript and I admire the power of DHTML.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Architect Ogeronet Libantelecom
Lebanon Lebanon
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralJavaScript mounth Calendar Pin
shareef2220002-Jul-09 22:11
shareef2220002-Jul-09 22:11 
GeneralRe: JavaScript mounth Calendar Pin
Chamadness3-Jul-09 1:24
Chamadness3-Jul-09 1:24 
QuestionUndefined??? Pin
Binoy Rajan11-Aug-08 7:29
Binoy Rajan11-Aug-08 7:29 
QuestionWill it work with ASP.Net Server Comntrols?????????? Pin
Binoy Rajan8-Aug-08 13:33
Binoy Rajan8-Aug-08 13:33 
GeneralactiveElement undefined Pin
ant326-Jun-06 4:10
ant326-Jun-06 4:10 
GeneralRe: activeElement undefined Pin
Chamadness26-Jun-06 5:35
Chamadness26-Jun-06 5:35 
GeneralRe: activeElement undefined Pin
ant326-Jun-06 9:08
ant326-Jun-06 9:08 
Generalundefined Pin
Binoy Rajan11-Aug-08 7:31
Binoy Rajan11-Aug-08 7:31 
Afetr Selecting Date from Calendar, TextBox Shows "undefined"
Can u please Help me for this
GeneralSmall Firefox bug Pin
mikeo_code18-May-06 0:28
mikeo_code18-May-06 0:28 
GeneralThank you Pin
specky8528-Feb-06 2:25
specky8528-Feb-06 2:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.