rookie css question

J

jtrecords

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
 
D

DeltaX

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!
 
R

RobG

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:

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

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

jtrecords

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>.
 
R

Richard Cornford

I have this in my html,...

<link rel="stylesheet" type="text/css" href="assets/base.css" />
</head>
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top