Connecting Tech Pros Worldwide Help | Site Map

rookie css question

jtrecords@yahoo.com
Guest
 
Posts: n/a
#1: Jul 23 '05
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

DeltaX
Guest
 
Posts: n/a
#2: Jul 23 '05

re: rookie css question


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!

RobG
Guest
 
Posts: n/a
#3: Jul 23 '05

re: rookie css question


jtrecords@yahoo.com wrote:[color=blue]
> 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 + ", " +[/color]

You probably want to remove the 'date + ...' line
[color=blue]
> (fourdigits(now.getYear())) ;[/color]

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>
[color=blue]
>
> // Print out the data.
> document.write("" +today+ "");[/color]

document.write('<p class="someClass" '
+ 'style="font-family: sans-serif;">'
+ today + '<\/p>');
[color=blue]
>
> TIA!
> JT
>[/color]


--
Rob
jtrecords@yahoo.com
Guest
 
Posts: n/a
#4: Jul 23 '05

re: rookie css question


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

Richard Cornford
Guest
 
Posts: n/a
#5: Jul 23 '05

re: rookie css question


jtrecords@yahoo.com wrote:
<snip>[color=blue]
> I have this in my html,...
>
><link rel="stylesheet" type="text/css" href="assets/base.css" />
> </head>[/color]
<snip>[color=blue]
> I'll try to learn something in the meantime <g>.[/color]

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.


Closed Thread


Similar JavaScript / Ajax / DHTML bytes