Amending this Javascript

Discussion in 'JavaScript' started by defted, Sep 30, 2008.

  1. #1
    Hello Guys, I've got this js that shows the current date in a users browsers. It actually replaces the page's TITLE with the current date. What i would like to find out is if someone can edit to show the page's title and the current date?

    For example, if i have a title as 'Financial sector - the review', can it be altered to show something like 'Financial sector - the review, Tuesday September, 30 2008'?

    This is the code:
    <script language="JavaScript">
    <!--
    
    function writeIt() {
    
    // getDate
    var now = new Date();
    var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
    var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
    var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
    
    // quadYear
    function y2k(number){return (number < 1000) ? number + 1900 : number;}
    
    // glueIt
    today =  days[now.getDay()] + " " +
                   months[now.getMonth()] + ", " +
                    date + " " +
                    (y2k(now.getYear())) ;
    
       if(document.all || document.getElementById){ // Browser Check
          document.title = today.toString();
       }else{
          self.status = today.toString(); // Default to status.
       }
    }
    
    writeIt();
    
    //-->
    </script>
    Code (markup):
    thnx.
     
    defted, Sep 30, 2008 IP
  2. defted

    defted Active Member

    Messages:
    110
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #2
    Cheers guys, hav sorted it out @ websitebabble.com
     
    defted, Oct 1, 2008 IP