View Single Post
  #1 (permalink)  
Old August 24th, 2006, 06:31 PM
webdesign webdesign is offline
Registered User
 
Join Date: Aug 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default external CSS in JavaScript code

Is is possible to reference external style sheets in JavaScript code?
See the document.write statement below which shows the class name as dayofweek which refers to an external style sheet.

document.write('<span class="dayofweek">' + weekDay[i],"</span>");

Here is the external style sheet:
    .dayofweek {
        color: red;
        font: bold 1.25em "Times New Roman";
        }

I don't know if the DTD is the problem or not. Below is the DTD I used which I understand forces standards mode.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
     <link rel="stylesheet" type="text/css" href="external.css" />

<html xmlns="http://www.w3.org/1999/xhtml">

In my tests, using Firefox and IE 6, the style sheet is not rendered when written as an external style sheet but does work fine in both browsers when used as an embedded(internal)style sheet.
Thanks for any help.
Reply With Quote