CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2002
    Location
    Ontario Canada
    Posts
    34

    Document modified Netscape Browser Native Date

    After I update my html files, browser displays last modified date. I am tring to get Netscape browser native date displays as

    December 31, 1999

    instead of

    Friday, December 31, 1999 07:04:34

    The above format is through Netscape 4.7-6.0, Its different on 7.0, Do NOT try it on Netscape 7.0
    all the other version of IE and netscape are working fine.

    Help appreciated.
    Thanks

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>test</title>
    <meta http-equiv="content-type"
    content="text/html; charset=ISO-8859-1">
    </head>
    <body>
    <script language = "JavaScript">
    <!--
    var messege=document.lastModified;
    document.write(location.hostname+"<br>")
    window.defaultStatus=Math.PI;
    if (navigator.appName.substring(0,8) == "Netscape")
    {
    if (navigator.appVersion.substring(0,3) >=4.5)
    // Display date for new Netscape version
    // var words=messege.split(",");
    // words.sort();
    // for (i=0; i < words.length; i++)
    // document.write(words + "<br>");
    document.write(document.lastModified.substring(0,12)+"<br>"+document.lastModified+"<br>"+messege.toUpperCase());
    else
    // display date for old Netscape versions
    document.write(document.lastModified.substring(0,8));
    }
    else
    {
    // if {put test for new IE versions here)
    if (navigator.appName == "Microsoft Internet Explorer")
    // display date for new IE versions
    document.write(document.lastModified.substring(0,10)+"<br>"+document.lastModified);
    else
    // display date for old IE versions
    document.write(document.lastModified.substring(0,8));
    }
    //-->
    </script>
    <br>
    </body>
    </html>

  2. #2
    Join Date
    Aug 2002
    Location
    Reykjavik, Iceland
    Posts
    201
    This works for Netscape 4.7 - Netscape 6.2

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>test</title>
    <meta http-equiv="content-type"
    content="text/html; charset=ISO-8859-1">
    </head>
    <body>
    <script language = "JavaScript">
    <!--
    var messege=document.lastModified;
    document.write(location.hostname+"<br>")
    window.defaultStatus=Math.PI;
    if (navigator.appName.substring(0,8) == "Netscape"){
    if (navigator.appVersion.substring(0,3) >=4.5) {
    words=messege.split(",");
    year=words[2].split(" ");
    document.write(words[1]+ ", " + year[1] + "<br>");
    } else {
    document.write(document.lastModified.substring(0,8));
    }
    } else {
    // if {put test for new IE versions here)
    if (navigator.appName == "Microsoft Internet Explorer")
    // display date for new IE versions
    document.write(document.lastModified.substring(0,10)+"<br>"+document.lastModified);
    else
    // display date for old IE versions
    document.write(document.lastModified.substring(0,8));
    }
    //-->
    </script>
    <br>
    </body>
    </html>

  3. #3
    Join Date
    Jan 2002
    Location
    Ontario Canada
    Posts
    34
    Thanks very much 4 your help. I have got it done.


    <script language = "JavaScript">
    <!--
    var messege=document.lastModified;

    var beg=(messege.indexOf(" "));

    var end=(messege.lastIndexOf(" "));

    if (navigator.appName.substring(0,8) == "Netscape")
    {
    if (navigator.appVersion.substring(0,3) >=4.5)
    // Display date for new Netscape version
    document.write(messege.substring(beg,end));
    else
    // display date for old Netscape versions
    document.write(document.lastModified.substring(0,8));
    }
    else
    {
    // if {put test for new IE versions here)
    if (navigator.appName == "Microsoft Internet Explorer")
    // display date for new IE versions
    document.write(document.lastModified.substring(0,10));
    else
    // display date for old IE versions
    document.write(document.lastModified.substring(0,8));
    }
    //-->
    </script>
    <noscript>
    <b>Please>/b> try this page for browsers that can not handle SCRIPTing.
    <a HREF="http://www.netscape.com/">Upgrade Browser</a>
    </noscript>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured