Popup Calendar

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • danilo

    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


  • Lasse Reichstein Nielsen

    #2
    Re: Popup Calendar

    "danilo" <prioreNOSPAM@t iscali.it> writes:
    [color=blue]
    > 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 :)[/color]

    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 - lrn@hotpop.com
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • Alberto

      #3
      Re: Popup Calendar

      He is working on that, he is using event.srcElemen t, 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)!="undef ined")?event.sr cElement:e.targ et;
      //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.sr cElement;
      }
      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




      Comment

      • Brynn

        #4
        Re: Popup Calendar


        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" <prioreNOSPAM@t iscali.it>
        wrote:
        [color=blue]
        >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
        >
        >[/color]

        Brynn


        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!

        Comment

        • Lasse Reichstein Nielsen

          #5
          Re: Popup Calendar

          "Alberto" <nospam@nospam. nospam> writes:
          [color=blue]
          > He is working on that,[/color]

          On what? (You have no quoted context, so it's hard to see what you are
          referring to)

          [color=blue]
          > function foo(e){
          > var object==(typeof (event)!="undef ined")?event.sr cElement:e.targ et;[/color]

          Indeed. I usually start my event handler functions as:
          ---
          function foo(event) {
          event = event || window.event; // IE sucks
          var tgt = event.target || event.srcElemen t; // do.
          ...
          ---
          (yes, the comments are usually there too :)
          [color=blue]
          > dont think he can achieve compatibility with NS4, but that was
          > arguably never his goal.[/color]

          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 :)
          [color=blue]
          > 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.[/color]

          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 - lrn@hotpop.com
          DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
          'Faith without judgement merely degrades the spirit divine.'

          Comment

          Working...