Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Aug 2002
    Posts
    89
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Help in changing date scripts font, bold and size.

    Im designing a page in DW4 and am using the following script to automatically insert todays date. The page font which I'm using is Comic Sans MS, bold, size 2, but when the page loads, the date is displayed in what appears to be Times New Roman. I've tried different mixes to insert the HTML <b><font face="Comic Sans MS" size="2"> </font></b> but cant get it to function on the date. Any help would be appreciated. CODE FOLLOWS -

    <script language="Javascript"><!--
    // ***********************************************
    // AUTHOR: WWW.CGISCRIPT.NET, LLC
    // Get today's current date.
    var now = new Date();

    // Array list of days.
    var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');

    // Array list of months.
    var months = new Array('January','February','March','April','May','June','July','August','September','October','Novem ber','December');

    // Calculate the number of the current day in the week.
    var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();

    // Calculate four digit year.
    function fourdigits(number) {
    return (number < 1000) ? number + 1900 : number;
    }
    // Join it all together
    today = days[now.getDay()] + ", " +
    months[now.getMonth()] + " " +
    date + ", " +
    (fourdigits(now.getYear())) ;

    // Print out the data.
    document.write(today+ ".");
    //--></script>

  • #2
    Regular Coder
    Join Date
    Dec 2002
    Location
    Ontario, Canada
    Posts
    183
    Thanks
    0
    Thanked 1 Time in 1 Post

    Lightbulb Cascading Style Sheets should do it for you

    You could use CSS in your htm to make all or just some of the text on your page whatever font and style you want.

    In your <head> tag type

    <style Type="text/css">
    <!--
    body{color: #0000ff; font-family: "Comic Sans MS"; font-size: 2px; font-weight: bold;}
    //-->
    </style>

    This should change all the text on your page to Comic Sans MS and blue. There are a lot of other nice options you can set with CSS.

    First though take out the <font> tags around your date script.

  • #3
    New Coder
    Join Date
    Aug 2002
    Posts
    89
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lightbulb

    Thanks Frank

    That sounds an excellent idea, except that ;

    1 I've not really worked with CSS before, &

    2 That would make everything on the page default to that size, etc (I think) and thats not what I want to do.

    Is it possible just to set the date script please?

    Stephen

  • #4
    Regular Coder
    Join Date
    Dec 2002
    Location
    Ontario, Canada
    Posts
    183
    Thanks
    0
    Thanked 1 Time in 1 Post

    Lightbulb

    It's ok if your not use to CSS.

    Place this before your script.
    <div style= "font-family: Comic Sans MS; font-weight: bold; font-size: 20px;">

    And this after</div>

    The tag does not need to be "div" it could just as easily be "p".
    You may want to play around with the font-size to get it the right size, I looked at size 2 and its really small. If you want to use it just type font-size: 2;

    Good luck.
    Frank

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    United Kingdom Confused: Often
    Posts
    859
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i think "font-size: 10pt;" is more or less equivalent of <font size="2">

    try searching for "font size"... it should have some interesting threads on the subject.
    redhead

  • #6
    New Coder
    Join Date
    Aug 2002
    Posts
    89
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks very much Frank and Redhead - it worked a treat with size 15.

    Its great to know that this sort of support exists on the web and in this forum.

    Stephen
    BTW, Frank, I'll give some thought to CSS. I tried your code and it worked as you suggested. That was my back-up plan.


  •  

    Posting Permissions

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