javascript and netscape

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brian H¹©

    javascript and netscape

    The following script works ok for IE, but when someone views it using Netscape
    the year shows as 103, is there anything that can be changed in the script to
    render it Netscape friendlier please?
    Thanks

    <SCRIPT language=JavaSc ript><!--
    var DayOfWeek = new
    Array('Sunday', 'Monday','Tuesd ay','Wednesday' ,'Thursday','Fr iday','Saturday ');
    var theDate = new Date();
    var MonthName = new
    Array('January' ,'February','Ma rch','April','M ay','June','Jul y','August','Se ptemb
    er',
    'October','Nove mber','December ');


    document.write( '<NOBR>' +
    DayOfWeek[theDate.getDay( )] + ' ' +
    theDate.getDate () + ' ' +
    MonthName[theDate.getMont h()] + ', ' +
    (theDate.getYea r() < 100 ? theDate.getYear () + 1900 :
    theDate.getYear ()) +
    '</font></NOBR>');
    //--></SCRIPT>


  • HikksNotAtHome

    #2
    Re: javascript and netscape

    In article <Ht1ib.578$mM1. 263@newsfep4-winn.server.ntl i.net>, "Brian H¹©"
    <no.spam@this.a ddy.ta> writes:
    [color=blue]
    >The following script works ok for IE, but when someone views it using
    >Netscape
    >the year shows as 103, is there anything that can be changed in the script to
    >render it Netscape friendlier please?[/color]

    Yes. Use getFullYear instead of getYear.
    --
    Randy

    Comment

    • Brian H¹©

      #3
      Re: javascript and netscape

      HikksNotAtHome said:
      [color=blue]
      > In article <Ht1ib.578$mM1. 263@newsfep4-winn.server.ntl i.net>, "Brian H¹©"
      > <no.spam@this.a ddy.ta> writes:
      >[color=green]
      >> The following script works ok for IE, but when someone views it using
      >> Netscape
      >> the year shows as 103, is there anything that can be changed in the script to
      >> render it Netscape friendlier please?[/color]
      >
      > Yes. Use getFullYear instead of getYear.[/color]

      Thank you.


      Comment

      • Dr John Stockton

        #4
        Re: javascript and netscape

        JRS: In article <Ht1ib.578$mM1. 263@newsfep4-winn.server.ntl i.net>, seen
        in news:comp.lang. javascript, Brian H¹© <no.spam@this.a ddy.ta> posted at
        Sun, 12 Oct 2003 01:44:24 :-[color=blue]
        >The following script works ok for IE, but when someone views it using Netscape
        >the year shows as 103, is there anything that can be changed in the script to
        >render it Netscape friendlier please?[/color]

        Method getFullYear is available in most browsers; but all you need to do
        is to change 100 to 1000 or 1e3.

        When posting code, do not allow your news software to line-wrap it; that
        is inconsiderate towards possible readers.

        Telling your readers the current local date is rather pointless and a
        waste of resources; they can discover it in many other ways.

        Read the FAQ.

        --
        © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
        <URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang. javascript
        <URL:http://www.merlyn.demo n.co.uk/js-index.htm> JS maths, dates, sources.
        <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.

        Comment

        Working...