Welcome to TalkGraphics.com
Page 1 of 3 123 LastLast
Results 1 to 10 of 21
  1. #1
    Join Date
    Mar 2009
    Posts
    3,597

    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
    3,597

    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
    12,053

    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 and active Xara software: Cloud+/Pro+, XDPX, XWD Premium 15 & 12, XPGD10, X3D7, Xara Xtreme 5, back through time (to CC's Artworks).
    Raise software faults with MagiXara: http://support.magix.net/; if Cloud+/Pro+: https://xara.com/contact-us/

  5. #5
    Join Date
    Mar 2009
    Posts
    3,597

    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
    12,053

    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 and active Xara software: Cloud+/Pro+, XDPX, XWD Premium 15 & 12, XPGD10, X3D7, Xara Xtreme 5, back through time (to CC's Artworks).
    Raise software faults with MagiXara: http://support.magix.net/; if Cloud+/Pro+: https://xara.com/contact-us/

  7. #7
    Join Date
    Aug 2000
    Location
    Placitas, New Mexico, USA
    Posts
    38,451

    Default Re: Which CSS to add?

    Acorn - I think the question is should the script you provided be added to the end of the original script posted, if I am understanding Boy's last post correctly.
    Gary W. Priester
    Mr. Moderator Emeritus Dude
    , Sir

    gwpriester.com | Custom-Stereograms.com | eyeTricks on Facebook






  8. #8
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    12,053

    Info Re: Which CSS to add?

    Here's a simple example - the detail is in the Names and in the Placeholder HTML code (body).
    You change font and colour as normal through Xara.

    JS - PageUpdateDetails.xar

    You can change the substr parameters for the start point and the number of characters to return.
    Each textline and associated code need a different Name if they are on the same page or different across a Supersite.

    Acorn
    Acorn - installed and active Xara software: Cloud+/Pro+, XDPX, XWD Premium 15 & 12, XPGD10, X3D7, Xara Xtreme 5, back through time (to CC's Artworks).
    Raise software faults with MagiXara: http://support.magix.net/; if Cloud+/Pro+: https://xara.com/contact-us/

  9. #9
    Join Date
    Mar 2009
    Posts
    3,597

    Default Re: Which CSS to add?

    Gary, you were right, that was my question.

    Brilliant Acorn. Short and simple. Thanks. But now the following question: Can I change the date to European format (day, month, year) and possibly have the months in another language, which I could do with the code I posted earlier?

  10. #10
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    12,053

    Default Re: Which CSS to add?

    Quote Originally Posted by Boy View Post
    Gary, you were right, that was my question.
    Brilliant Acorn. Short and simple. Thanks. But now the following question: Can I change the date to European format (day, month, year) and possibly have the months in another language, which I could do with the code I posted earlier?
    You could change toString() into to UTCString() or even toLocaleString().
    You can always use substr(from, length) to cut out bits of the date and time and then join them back together with the + operator.

    For other languages, you need toLocaleString(language, options).

    var options = {weekday: "long", year: "numeric", month: "long", day: "numeric"};
    document.getElementById("petra").innerHTML = updateDate.toLocaleString("de-DE", options);
    Acorn

    P.S. In the end there was no CSS to add as Xara does the styling. We have JavaScript to take the Date object and parse it into readable chunks using locales: https://developer.mozilla.org/en-US/...toLocaleString.
    Acorn - installed and active Xara software: Cloud+/Pro+, XDPX, XWD Premium 15 & 12, XPGD10, X3D7, Xara Xtreme 5, back through time (to CC's Artworks).
    Raise software faults with MagiXara: http://support.magix.net/; if Cloud+/Pro+: https://xara.com/contact-us/

 

 

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
  •