This is a discussion on "Attaching styles/classes to Javascript. Help!" within the Web Page Design section. This forum, and the thread "Attaching styles/classes to Javascript. Help! are both part of the Design Your Website category.
|
|
|
|
|
![]() |
||
Attaching styles/classes to Javascript. Help!
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Attaching styles/classes to Javascript. Help!
Hey everyone!
My first post on this forum - here goes! I have used CSS and Javascript seperatly with great effect before, but ive come up to a roadblock on the new site im working on. Either im just being dum or there really is something specific im supposed to be doing here. In this case there is a live clock on my site. Part of the Javascript code is as follows: var time=new Date();So you get the picture, quite simple. Problem is i want to change the font to 12pt which must be done with stylesheets. I made a seperate file with all my CSS in, and linked to it in the header of my page. I then tried various ways of putting the class to change the size of the font into this javascript, but it would always make the whole thing just stop working! where am I going wrong? Thanks for any advice! Steven. |
|
|
|
|||
|
Re: Attaching styles/classes to Javascript. Help!
Just wrap your clock in a <div id='clock'> and style in your css file in the normal way should do the job.
Also don't not use proprietary attributes as you have in your code. To change the text within the div, use - document.getElementById('clock') - to get the parent node within the DOM and change this parents child node. |
![]() |
| Tags |
| attaching, stylesclasses, javascript, help |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| attaching files | aashishahuja | PHP Forum | 2 | Jun 1st, 2008 02:42 |
| Problem attaching PHP to webpages | thumbliner | PHP Forum | 6 | Apr 20th, 2008 15:23 |
| CSS conflicting styles | ttaxi | Web Page Design | 2 | Mar 28th, 2008 16:01 |
| Uploading a Cv and attaching to an email | Gurpreet82 | Classic ASP | 4 | Mar 3rd, 2006 21:34 |
| Styles in classes? | timmytots | Web Page Design | 4 | Dec 2nd, 2005 01:20 |