Click here to Skip to main content
6,631,889 members and growing! (17,587 online)
Email Password   helpLost your password?
Web Development » Client side scripting » Beginners     Advanced

DHTML Calendar control with Time

By Sunil Kumtakar

DHTML Calendar control with Time
Javascript, Windows, Visual Studio, Dev
Posted:9 Jan 2007
Views:33,356
Bookmarked:35 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
7 votes for this article.
Popularity: 2.47 Rating: 2.93 out of 5
1 vote, 14.3%
1

2
2 votes, 28.6%
3
1 vote, 14.3%
4
3 votes, 42.9%
5

Sample Image - maximum width is 600 pixels

Introduction

It bring pleasure to present this DHTML Calendar Control with Time.  I have tried to make it as user friendly as possible, so that the user does not struggle while entering the date in your webforms. The other interesting part is it also includes the the interface to capture time.

I have tested it under IE 6, Netscape 8  and Opera 9, and it worked fine. Sorry I couldn't test it with other browser/ Versions.

Though the traditional Calendar display has not been discontinued. Which looks as follows (Clicking the calendar icon next to the Close button brings the traditional Calendar control). As of now it only accept date in dd-MMM-yyyy format.

Using the code

<Input type='text' name="txt21" id="txt21">
<IMG id=btn21 style="WIDTH: 20px; HEIGHT: 14px" 
   height=14 alt="Select Date" src="styles/smcal.gif" 
   width=24>

<script language="javascript"> myCalendar.setup({inputField : "txt21", button : "btn21"}); </script>

The following 2 lines are required under the <head> section of your page.

<LINK href="styles/mycalendar.css" type="text/css" rel="STYLESHEET">
<script src="styles/myCalendar.js" type="text/javascript"></script>

First you are required to place an input control type='text' as in line 1 next place an img control next to it as in line 2(remember to provide a proper value for its ID attribute).

Copy the lines 3 to 5 as it is, and then change the values against the "inputField" and "button" parameters on line 4. Refer to the test.html file in the zip for more help.

Points of Interest

It was really fun writing this script, it gave me a good exposure in javascript, though annoying at times when I used to get stuck in a problems for solving browser incompatiblity.  It was really fun to get the control working under different Browsers.

History

No history as of now.

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

About the Author

Sunil Kumtakar


Member
biography
Occupation: Web Developer
Location: India India

Other popular Client side scripting articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 12 of 12 (Total in Forum: 12) (Refresh)FirstPrevNext
GeneralSeconds??? Pinmembernfiskeo4:08 26 Oct '09  
Generalneeds validation PinmemberWill6619:44 28 Mar '08  
GeneralRe: needs validation PinmemberFelixAlmodovar3:23 29 Jun '08  
GeneralJavascript event calendar Pinmembernbohr99a4:58 9 Sep '07  
QuestionYour calendar js in xsl file. Pinmemberyosizack5:34 28 Jul '07  
GeneralImplementing Two Instances of the Calendar PinmemberTheMadRef9:55 25 Mar '07  
Questionhelp! help! help! undefine myCalendar [modified] Pinmemberfuxiurong_200120:44 4 Mar '07  
AnswerRe: help! help! help! undefine myCalendar PinmemberSunil Kumtakar6:32 5 Mar '07  
QuestionControl is going back Pinmemberramanatha reddy5:11 21 Feb '07  
GeneralMozilla/MAC Compability? PinmemberTheMadRef10:31 25 Jan '07  
GeneralRe: Mozilla/MAC Compability? PinmemberSunil Kumtakar2:39 27 Jan '07  
GeneralGood job Pinmembershewo19:14 17 Jan '07  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 9 Jan 2007
Editor: Paul Conrad
Copyright 2007 by Sunil Kumtakar
Everything else Copyright © CodeProject, 1999-2009
Web18 | Advertise on the Code Project