Welcome to TalkGraphics.com
Results 1 to 10 of 21

Hybrid View

  1. #1
    Join Date
    Mar 2009
    Posts
    4,503

    Default Which CSS to add?

    I would like to use a placeholder for a message saying "Last update on [Date]". I found some code on the internet but I would like to adjust the font, size and color. I was only able to adjust the color. The font continues to be Arial and the size retains its default size. Any ideas what's wrong in the code?

    Code:
    <SCRIPT LANGUAGE="JavaScript">
    function Initialize()
    { this.length = Initialize.arguments.length
    for ( var i = 0; i < this.length; i++ ) this[ i + 1 ] =
    Initialize.arguments[ i ]
    }
    
    var DayOfWeek = new Initialize("Last update", "Last update", "Last update", "Last update", "Last update", "Last update", "Last update" );
    var MonthName = new Initialize("Jan.", "Feb.", "Mar.", "April",
    "May", "June", "July", "Aug.", "Sep.", "Oct.", "Nov.",
    "Dec.");
    var LastModifiedDate = new Date(document.lastModified);
    
    document.write(DayOfWeek[(LastModifiedDate.getDay() + 1 )] ,": ");
    document.write( LastModifiedDate.getDate() ," "  );
    year=LastModifiedDate.getYear();
    if (year<100) year+=100;
    if (year<1000) year+=1900;document.write(MonthName[(LastModifiedDate.getMonth() + 1)] ," ",( year ) );
    </SCRIPT>
    
    <div style="font:open-sans;font-size:18px;color:004c7e">
    <!-- SCRIPT OUTPUT -->
    </div>

  2. #2

    Default Re: Which CSS to add?

    The 3rd from the last line is:

    Code:
    <div style="font:open-sans;font-size:18px;color:004c7e">
    Which should be able to be changed. Depending upon when it gets loaded, you may need to add !important at the end (before the close angle bracket, and make sure to add the semi-colon before it...).

  3. #3
    Join Date
    Mar 2009
    Posts
    4,503

    Default Re: Which CSS to add?

    Thanks Mike, but could you spell that out for me? I don't seem to get it to work....

  4. #4
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,858

    Default Re: Which CSS to add?

    Try playing with something like this:
    <div id="updated" style="font: open-sans; font-size:18px; color:004c7e">&nbsp;</div><script>
    var updateDate = new Date(document.lastModified);
    document.getElementById("updated").innerHTML = updateDate;
    //alert(updateDate);
    </script>
    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  5. #5
    Join Date
    Mar 2009
    Posts
    4,503

    Default Re: Which CSS to add?

    Thanks Acorn. Still stumped though and don't get it to work. Should I place this at the end?

  6. #6
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,858

    Default Re: Which CSS to add?

    As it returns something inside a DIV tag, it needs to be in an object's placeholder body code.

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

 

 

Bookmarks

Posting Permissions

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