1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Can I change the font and color in a javascript?

Discussion in 'Software Development' started by starchild, Jan 14, 2005.

Thread Status:
Not open for further replies.
  1. starchild

    starchild Thread Starter

    Joined:
    Sep 17, 2002
    Messages:
    2,111
    I think I can in a stylesheet (I'm still trying to learn that)

    I came across this, to put the date on a page.

    <script language="JavaScript">
    <!--
    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();
    function fourdigits(number) {
    return (number < 1000) ? number + 1900 : number;}
    today = days[now.getDay()] + ", " +
    months[now.getMonth()] + " " +
    date + ", " +
    (fourdigits(now.getYear()));
    document.write(today);
    //-->
    </script>

    It seems very simple and basic, which would be good to learn from.

    The first thing I tried was to get it in the middle of the page. It just stays on the left side.

    Also, can I change the font and/or color of it?

    Not a big deal, just trying to learn about it.

    Thanks,

    Carrie
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/319411

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice