473,387 Members | 1,398 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Popup Calendar

This Javascript + DHTML source code able to show a popup calendar to select
one date in your web pages, complete the full sourcecode and its free
distribuite (GNU lic) http://www.prioregroup.com/dhtmlcalendar.html :)
Sorry for my english.
- Danilo
Jul 23 '05 #1
4 1844
"danilo" <pr**********@tiscali.it> writes:
This Javascript + DHTML source code able to show a popup calendar to select
one date in your web pages, complete the full sourcecode and its free
distribuite (GNU lic) http://www.prioregroup.com/dhtmlcalendar.html :)


Looks nice. Works in Opera 7. However, it fails in Mozilla. I noticed
a use of "innerText", which is a proprietary Microsoft invention not
implemented by Mozilla. There might be more.

The only comment I have to how it looks is that it always has Sundays
first, where I would expect, e.g., German calendars to have Sundays
last.

For the code, I would prefer a more parameterized design, where you
create a new calendar by giving it the names of days and months and
the format of text dates (and whether to put Sundays first :), instead
of having that information hardcoded in various parts of the code.
That would make it, slightly, easier to adjust to other nationalities.

Likewise for the generated HTML. Instead of inlining a lot of styles,
the elements could have classes so the author could just swap a
stylesheet to make the calendar look different.

And for addEvent, I would use feature detection instead of try/catch.
It's cleaner and more likely to work in older browsers (but the calendar
probably doesn't work in older browsers anyway).
Good job
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #2
He is working on that, he is using event.srcElement, I suggested to him in
an italian newsgroup, in order to produce compatibility with Mozilla which
he desires,
to give a name to the argument passed as an event, say (traditionally) "e":

function foo(e){
var object==(typeof(event)!="undefined")?event.srcElem ent:e.target;
//bla bla
}

that should be the good start to work latger on on Mozilla too.

Achieved with a shortcut statement, alternative way:

var object;
if( typeof(event)!="undefined") ){
object=event.srcElement;
}
else{
object=e.target;
};
if(!object) bla bla, dont think he can achieve compatibility with NS4, but
that was arguably never his goal.

The code above can be changed removing the brackets after typeof if one
doesn't like them, and the trailing column if one doesn't like it.
Irrelevant details.

innerText should be replaced with innerHTML. Reichstein is absolutely right
about it. Yeah, to be precise, the W3C recommandation argues nodes should be
added one at a time. Yet if he does that by innerHTML, he achieves the
result as well, which is what matters to not too purist eyes.

It's so nifty an application that I linked him to my website.
I suggest everybody have a look at what a nice thing he has done. Worth your
time, and it seems to me Reichstein concurs.

Additionally, he could provide a drop down menu with the returned formats of
the date. Reichstein suggests that as well. Actually, he should _at_least_
allow for the latin and anglo saxon format, say
<option>mm/dd/yyy (anglo saxon)
<option>dd/mm/yyy (latin)

Note that the application has buttons that move forward or backward month by
month, those buttons are small and could escape at a first perusal.
I suggest enlarging them a bit or giving to them a stronger color, they are
so nice a feature it is bad that at first sight they don't appear
immediately available.

It's a terrific job, a very very very nice application (I DO like stressing
good sides of the things), and I feel like praising him even if he was
using innerText - he can just "fix" that and a couple of details and he will
achieve perfection.

Speak of constructive observations expressed in a civilized manner that
doesn't belittle the achievement in the name of a few implementation details
LOL
ciao
Alberto
http://www.unitedscripters.com/

Jul 23 '05 #3

I built this from scratch ... could eaily build that one.

If there is a high need, let me know ... I will build it, and have it
where you can pull the data from a textfile or database for the day.

On Thu, 19 Aug 2004 00:02:19 GMT, "danilo" <pr**********@tiscali.it>
wrote:
This Javascript + DHTML source code able to show a popup calendar to select
one date in your web pages, complete the full sourcecode and its free
distribuite (GNU lic) http://www.prioregroup.com/dhtmlcalendar.html :)
Sorry for my english.
- Danilo


Brynn
www.coolpier.com

I participate in the group to help give examples of code.
I do not guarantee the effects of any code posted.
Test all code before use!
Jul 23 '05 #4
"Alberto" <no****@nospam.nospam> writes:
He is working on that,
On what? (You have no quoted context, so it's hard to see what you are
referring to)

function foo(e){
var object==(typeof(event)!="undefined")?event.srcElem ent:e.target;
Indeed. I usually start my event handler functions as:
---
function foo(event) {
event = event || window.event; // IE sucks
var tgt = event.target || event.srcElement; // do.
...
---
(yes, the comments are usually there too :)
dont think he can achieve compatibility with NS4, but that was
arguably never his goal.
It might be possible, by putting the calendar into a NS4-layer. That
could allow changing the content as well as positioning the calendar.
However, it would require a completely spearate way of doing pretty
much everything, so it's unlikely that it's worth doing. Netscape 4
is not as dead as it should be, but it's damn close :)
innerText should be replaced with innerHTML. Reichstein is absolutely right
about it. Yeah, to be precise, the W3C recommandation argues nodes should be
added one at a time. Yet if he does that by innerHTML, he achieves the
result as well, which is what matters to not too purist eyes.


innerHTML is probably the non-standard property that is most widely
implemented. If one is only aiming at the most common modern browsers,
then it should work.

Now, I *am* apurist at heart, so I would probably make a fallback :)
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Caesar Augustus | last post by:
I'm having a problem with two different javascript controls in my app. The first chuck of javascript that I pasted into my app is the client-side calendar control popup which works fine when first...
4
by: Ali | last post by:
i am using visual studio 2005 and I am trying to create a popup calender so when a user click on a image on the main form, a calender will then popup, the user will select a date and the date will...
3
by: Peter | last post by:
Does anyone have an example of how you would do a popup window when a user clicks on a day number link in the ASP.NET Web Calendar control? I am trying to create an event calendar similar to how...
1
by: Garth Wells | last post by:
I found sample code that shows me how to implement a popup calendar, but I would like the calendar to popup at the lower right of the Input to which it's associated...the way Sharepoint popup...
0
by: R.A.M. | last post by:
Hello, I need to implement popup calendar in ASP.NET application. I created a button opening popup calendar on 'master' page: <asp:Button ID="Calendar" runat="server" Text=Calendar"...
1
by: R.A.M. | last post by:
Hello, I need to implement popup calendar in ASP.NET application. I created a button opening popup calendar on 'master' page: <asp:Button ID="Calendar" runat="server" Text=Calendar"...
0
by: GV | last post by:
Hi all, New to developing in VS 2005 ASP 2.0 Trying to have a easy pop calender for a button on a web page. I keep getting a error message in IE6 that says: Line 69 Char 3 Error:...
5
by: rockdale | last post by:
Hi, I tried to search web for an non-popup calendar control, (like javascript calendar) but could not find a good solution. Most solutions are popup another window and show the calendar, then...
4
by: ShyGuy | last post by:
A while back I had found a link to a popup calendar that had a small button that was placed to the right of any text box. By clicking on the icon and selecting a date the text box was updated with...
3
by: mikaint | last post by:
I'm really confused here...i'll need some help with the following... i have a sceipt that will open a popup win which is actually a calendar and i'm trying to apply a style on the popup... Here's...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.