2 Questions (Date and Write)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dennis M. Marks

    2 Questions (Date and Write)

    1. The getYear() function returns 2004 in IE and 104 in Netscape. Is
    that normal? It's no problem. I just add 1900 if it is less than 1000.
    Maybe there is an updated function. Let me know.

    2. Is there a way to use document.write after the page is displayed
    without redrawing the entire page? I don't want to use a frame or
    iframe. What I am trying to do is display a calendar and if the date is
    changed then redraw it.

    You can see my calendar so far at my home page.

    --
    Dennis M. Marks

    Replace domain.invalid with dcsi.net


    -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
    http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
    -----== Over 100,000 Newsgroups - 19 Different Servers! =-----
  • Lasse Reichstein Nielsen

    #2
    Re: 2 Questions (Date and Write)

    "Dennis M. Marks" <denmarks@domai n.invalid> writes:
    [color=blue]
    > 1. The getYear() function returns 2004 in IE and 104 in Netscape.[/color]

    Which Netscape? (testing.... both Netscape 4 and Mozilla ... and Opera.
    [color=blue]
    > Is that normal?[/color]

    Is what normal? That browsers differ? That IE is doing it wrong? No to
    both :)
    [color=blue]
    > It's no problem. I just add 1900 if it is less than
    > 1000. Maybe there is an updated function. Let me know.[/color]

    The updated function is getFullYear. It is not available in all old
    browsers (although it does seem to exist in both Netscape 4 and IE 4).
    [color=blue]
    > 2. Is there a way to use document.write after the page is displayed
    > without redrawing the entire page?[/color]

    No. If you need to add content to a page after it has loaded, you must
    use either W3C DOM methods or the Microsoft DOM "innerHTML" property.
    Or put the content inside an input element.

    /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

    • George Jempty

      #3
      Re: 2 Questions (Date and Write)

      Dennis M. Marks wrote:[color=blue]
      > 1. The getYear() function returns 2004 in IE and 104 in Netscape. Is
      > that normal? It's no problem. I just add 1900 if it is less than 1000.
      > Maybe there is an updated function. Let me know.
      >
      > 2. Is there a way to use document.write after the page is displayed
      > without redrawing the entire page? I don't want to use a frame or
      > iframe. What I am trying to do is display a calendar and if the date is
      > changed then redraw it.[/color]

      As for issue 2. This can be done using the DOM: Document Object Model.
      In essence you create a sort of placeholder in the page that can be
      written to after the fact. There is a good example of how to do this
      sort of thing in the most current edition of Flanagan's "Rhino" book
      (Javascript: The Definitive Guide). This book is a must-have, and you
      can get it immediately by signing up for a free 2-week trial
      subscription to 5 (or more) books online, at safari.oreilly. com

      Comment

      • Dennis M. Marks

        #4
        Re: 2 Questions (Date and Write)

        I have read the following message from "Dennis M. Marks"
        <denmarks@domai n.invalid>
        and have decided to lend my vast knowledge.

        The writer said:[color=blue]
        > 1. The getYear() function returns 2004 in IE and 104 in Netscape. Is
        > that normal? It's no problem. I just add 1900 if it is less than 1000.
        > Maybe there is an updated function. Let me know.
        >
        > 2. Is there a way to use document.write after the page is displayed
        > without redrawing the entire page? I don't want to use a frame or
        > iframe. What I am trying to do is display a calendar and if the date is
        > changed then redraw it.
        >
        > You can see my calendar so far at my home page.
        >
        >
        >[/color]

        and my reply is:
        I found the answer to question 1 (getFullYear). I still need an answer
        to question 2.

        --
        Dennis M. Marks

        Replace domain.invalid with dcsi.net


        -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
        http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
        -----== Over 100,000 Newsgroups - 19 Different Servers! =-----

        Comment

        • toylet

          #5
          Re: 2 Questions (Date and Write)

          > 2. Is there a way to use document.write after the page is displayed[color=blue]
          > without redrawing the entire page? I don't want to use a frame or
          > iframe. What I am trying to do is display a calendar and if the date is
          > changed then redraw it.[/color]

          Client-side speaking, that's also a redraw of the page. You cannot
          objectify a bunch of HTML tags and do a object.refresh( ) like VB or C++.

          --
          .~. Might, Courage, Vision. In Linux We Trust.
          / v \ http://www.linux-sxs.org
          /( _ )\ Linux 2.4.22-xfs
          ^ ^ 1:22am up 1 day 1:42 load average: 1.00 1.00 1.01

          Comment

          • Randy Webb

            #6
            Re: 2 Questions (Date and Write)

            Lasse Reichstein Nielsen wrote:
            [color=blue]
            > "Dennis M. Marks" <denmarks@domai n.invalid> writes:
            >
            >[color=green]
            >>1. The getYear() function returns 2004 in IE and 104 in Netscape.[/color]
            >
            >
            > Which Netscape? (testing.... both Netscape 4 and Mozilla ... and Opera.
            >
            >[color=green]
            >>Is that normal?[/color]
            >
            >
            > Is what normal? That browsers differ? That IE is doing it wrong? No to
            > both :)[/color]

            Actually, they are both getting it wrong. getYear *should* return the 2
            digit year, of which neither is doing that properly.

            --
            Randy
            Chance Favors The Prepared Mind
            comp.lang.javas cript FAQ - http://jibbering.com/faq/

            Comment

            • Randy Webb

              #7
              Re: 2 Questions (Date and Write)

              George Jempty wrote:
              [color=blue]
              > Dennis M. Marks wrote:
              >[color=green]
              >> 1. The getYear() function returns 2004 in IE and 104 in Netscape. Is
              >> that normal? It's no problem. I just add 1900 if it is less than 1000.
              >> Maybe there is an updated function. Let me know.
              >>
              >> 2. Is there a way to use document.write after the page is displayed
              >> without redrawing the entire page? I don't want to use a frame or
              >> iframe. What I am trying to do is display a calendar and if the date is
              >> changed then redraw it.[/color]
              >
              >
              > As for issue 2. This can be done using the DOM: Document Object Model.[/color]

              Technically, its done with Javascript. Javascript and the DOM are two
              different things.
              [color=blue]
              > In essence you create a sort of placeholder in the page that can be
              > written to after the fact. There is a good example of how to do this
              > sort of thing in the most current edition of Flanagan's "Rhino" book
              > (Javascript: The Definitive Guide). This book is a must-have, and you
              > can get it immediately by signing up for a free 2-week trial
              > subscription to 5 (or more) books online, at safari.oreilly. com[/color]



              --
              Randy
              Chance Favors The Prepared Mind
              comp.lang.javas cript FAQ - http://jibbering.com/faq/

              Comment

              • Lasse Reichstein Nielsen

                #8
                Re: 2 Questions (Date and Write)

                Randy Webb <hikksnotathome @aol.com> writes:
                [color=blue]
                > Actually, they are both getting it wrong. getYear *should* return the
                > 2 digit year, of which neither is doing that properly.[/color]

                If you follow the recommendation of ECMA262, getYear (which is not a
                required property of ECMAScript Date objects) should return the
                year - 1900:
                ---
                B.2.4 Date.prototype. getYear ( )
                NOTE The getFullYear method is preferred for nearly all purposes,
                because it avoids the "year 2000 problem."
                When the getYear method is called with no arguments the following
                steps are taken:
                1. Let t be this time value.
                2. If t is NaN, return NaN.
                3. Return YearFromTime(Lo calTime(t)) -1900.
                ---

                It is from Appendix B of the ECMAScript standard, which includes
                non-normative suggestions for a uniform semantics of common
                non-standardized features. These are "escape", "unescape",
                "String.prototy pe.substr", "Date.prototype .getYear",
                "Date.prototype .setYear", and "Date.prototype .toGMTString".

                /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

                • George Jempty

                  #9
                  Re: 2 Questions (Date and Write)

                  >> As for issue 2. This can be done using the DOM: Document Object Model.[color=blue]
                  >
                  >
                  > Technically, its done with Javascript. Javascript and the DOM are two
                  > different things.[/color]

                  Really? Wow! But Javascript is just a simpler form of Java, right?

                  TIA!!

                  Comment

                  • George Jempty

                    #10
                    Re: 2 Questions (Date and Write)

                    George Jempty wrote:[color=blue][color=green][color=darkred]
                    >>> As for issue 2. This can be done using the DOM: Document Object Model.[/color]
                    >>
                    >>
                    >>
                    >> Technically, its done with Javascript. Javascript and the DOM are two
                    >> different things.[/color]
                    >
                    >
                    > Really? Wow! But Javascript is just a simpler form of Java, right?
                    >
                    > TIA!![/color]

                    PS...what's a FAQ?

                    Comment

                    • Lasse Reichstein Nielsen

                      #11
                      Re: 2 Questions (Date and Write)

                      George Jempty <fleetwoodd@bel lsouth.net> writes:
                      [color=blue]
                      > But Javascript is just a simpler form of Java, right?[/color]

                      No. Java and Javascript are two completely independent languages with
                      no more in common that "cat" and "caterpilla r". They look
                      superficially alike because they both use C-like syntax, but below the
                      hood they are from differet worlds.

                      /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

                      • George Jempty

                        #12
                        Re: 2 Questions (Date and Write)

                        Lasse Reichstein Nielsen wrote:
                        [color=blue]
                        > George Jempty <fleetwoodd@bel lsouth.net> writes:
                        >
                        >[color=green]
                        >>But Javascript is just a simpler form of Java, right?[/color]
                        >
                        >
                        > No.[/color]

                        I was being sarcastic.

                        Don't you remember me? I was contributing on this board late last
                        summer. In fact, I've since gotten to use some properly functioning
                        auto-tab code me, and others on this group (sincere thanks), worked out;
                        I've actually deployed it in a *production* setting.

                        But I see we've incorporated a new set of wannabes -- er, I mean
                        "theorists" -- in the meantime.

                        Comment

                        • Randy Webb

                          #13
                          Re: 2 Questions (Date and Write)

                          Dennis M. Marks wrote:[color=blue]
                          > I have read the following message from "Dennis M. Marks"
                          > <denmarks@domai n.invalid>
                          > and have decided to lend my vast knowledge.
                          >
                          > The writer said:
                          >[color=green]
                          >>1. The getYear() function returns 2004 in IE and 104 in Netscape. Is
                          >>that normal? It's no problem. I just add 1900 if it is less than 1000.
                          >>Maybe there is an updated function. Let me know.
                          >>
                          >>2. Is there a way to use document.write after the page is displayed
                          >>without redrawing the entire page? I don't want to use a frame or
                          >>iframe. What I am trying to do is display a calendar and if the date is
                          >>changed then redraw it.
                          >>
                          >>You can see my calendar so far at my home page.
                          >>
                          >>
                          >>[/color]
                          >
                          >
                          > and my reply is:
                          > I found the answer to question 1 (getFullYear). I still need an answer
                          > to question 2.[/color]

                          Actually, you did. The answer is no. The solution to what you want to do
                          is outlined in http://www.jibbering.com/faq/#FAQ4_15 (that URL was
                          given, if by noone else, by me.)

                          --
                          Randy
                          Chance Favors The Prepared Mind
                          comp.lang.javas cript FAQ - http://jibbering.com/faq/

                          Comment

                          • Randy Webb

                            #14
                            Re: 2 Questions (Date and Write)

                            George Jempty wrote:[color=blue][color=green][color=darkred]
                            >>> As for issue 2. This can be done using the DOM: Document Object Model.[/color]
                            >>
                            >>
                            >>
                            >> Technically, its done with Javascript. Javascript and the DOM are two
                            >> different things.[/color]
                            >
                            >
                            > Really? Wow! But Javascript is just a simpler form of Java, right?[/color]

                            Just like cars are a simpler form of carpet.

                            --
                            Randy
                            Chance Favors The Prepared Mind
                            comp.lang.javas cript FAQ - http://jibbering.com/faq/

                            Comment

                            • Randy Webb

                              #15
                              Re: 2 Questions (Date and Write)

                              George Jempty wrote:
                              [color=blue]
                              > Lasse Reichstein Nielsen wrote:
                              >[color=green]
                              >> George Jempty <fleetwoodd@bel lsouth.net> writes:
                              >>
                              >>[color=darkred]
                              >>> But Javascript is just a simpler form of Java, right?[/color]
                              >>
                              >>
                              >>
                              >> No.[/color]
                              >
                              >
                              > I was being sarcastic.
                              >
                              > Don't you remember me? I was contributing on this board late last
                              > summer. In fact, I've since gotten to use some properly functioning
                              > auto-tab code me, and others on this group (sincere thanks), worked out;
                              > I've actually deployed it in a *production* setting.
                              >
                              > But I see we've incorporated a new set of wannabes -- er, I mean
                              > "theorists" -- in the meantime.[/color]



                              Shows 2400 hits for "HikksNotAtHome ".



                              Shows 76 hits for "George Jempty".

                              OK, you got me, I am a wannabe/theorist. So, putting aside my personal
                              belief that ECMA is utterly useless since its just a theory about how
                              things should be instead of how things are, could you please explain how
                              the DOM is part of Javascript? And please tell which DOM you are
                              referring to, whether Level 0, Level 1, or Level 2.

                              I patiently await your "profession al" answer.
                              --
                              Randy
                              Chance Favors The Prepared Mind
                              comp.lang.javas cript FAQ - http://jibbering.com/faq/

                              Comment

                              Working...