rookie css question

Discussion in 'Javascript' started by jtrecords@yahoo.com, May 24, 2005.

  1. Guest

    I truly tried to get this one on my own...

    I am new to javascript, like 2 hours ago.
    So I'm messing with an example that inserts the current date in an html
    page. I want to keep the example and have my stylesheet fonts applied.


    Would someone kindly give me an example of how to get this done? Do I
    modify the document.write and where?

    ::excerpt from test.html::

    today = days[now.getDay()] + ", " +
    months[now.getMonth()] + " " +
    date + ", " +
    (fourdigits(now.getYear())) ;

    // Print out the data.
    document.write("" +today+ "");

    TIA!
    JT
     
    , May 24, 2005
    #1
    1. Advertising

  2. DeltaX Guest

    Hi ,

    There are three types of styles : inline , embaded, css stylesheet. I
    think you want this type!!

    You must first write your style of your elements and name that file a
    ..css
    Then, link that file with html ?.html >>>> But sould in the head e.g.
    <head>
    <link rel="stylesheet" type="text/css" href="a . css" />

    </head>
    In addition , modify document.write in JS also inside the head ....

    That what I have to tell!
     
    DeltaX, May 24, 2005
    #2
    1. Advertising

  3. RobG Guest

    wrote:
    > I truly tried to get this one on my own...
    >
    > I am new to javascript, like 2 hours ago.
    > So I'm messing with an example that inserts the current date in an html
    > page. I want to keep the example and have my stylesheet fonts applied.
    >
    >
    > Would someone kindly give me an example of how to get this done? Do I
    > modify the document.write and where?
    >
    > ::excerpt from test.html::
    >
    > today = days[now.getDay()] + ", " +
    > months[now.getMonth()] + " " +
    > date + ", " +


    You probably want to remove the 'date + ...' line

    > (fourdigits(now.getYear())) ;


    getFullYear() is pretty widely supported, so why not:

    now.getFullYear();


    For messing with date and time formats, have a read of Dr. J's pages:

    <URL:http://www.merlyn.demon.co.uk/js-index.htm>

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


    document.write('<p class="someClass" '
    + 'style="font-family: sans-serif;">'
    + today + '<\/p>');

    >
    > TIA!
    > JT
    >



    --
    Rob
     
    RobG, May 24, 2005
    #3
  4. Guest

    I appreciate the help. Should have included more info.
    I have this in my html, and what is defined in base.css is working for
    fonts, headers, etc:

    <link rel="stylesheet" type="text/css" href="assets/base.css" />
    </head>

    I havent' been able to find an example of document.write that I clearly
    see a call to the css, the junk I want to write, or how they work
    together. Or is it a better practice to create an element (?) in the
    css and use it the document.write statment? Any examples?
    I'll try to learn something in the meantime <g>.
     
    , May 24, 2005
    #4
  5. wrote:
    <snip>
    > I have this in my html,...
    >
    ><link rel="stylesheet" type="text/css" href="assets/base.css" />
    > </head>

    <snip>
    > I'll try to learn something in the meantime <g>.


    Prior to worrying about browser scripting, or CSS, it would be a good
    idea to learn how to write HTML. The above is not valid HTML, as
    feeding it through an HTML validator would rapidly reveal.

    Richard.
     
    Richard Cornford, May 25, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Big E

    Rookie Question

    Big E, Jun 17, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    354
    avnrao
    Jun 17, 2004
  2. Greg Smith

    Rookie question

    Greg Smith, Oct 7, 2005, in forum: Java
    Replies:
    4
    Views:
    363
    Monique Y. Mudama
    Oct 8, 2005
  3. Ian
    Replies:
    4
    Views:
    388
    Ian Rutgers
    Jan 22, 2005
  4. Don Bruder
    Replies:
    12
    Views:
    569
    Duncan Booth
    Sep 26, 2003
  5. Steve D. Perkins

    Rookie question about data types (hashtables)

    Steve D. Perkins, Jan 29, 2004, in forum: Python
    Replies:
    7
    Views:
    381
    Rainer Deyke
    Jan 29, 2004
Loading...

Share This Page