Subject: external CSS in JavaScript code
Posted By: webdesign Post Date: 8/24/2006 6:31:16 PM
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 By: ciwluke Reply Date: 9/1/2006 4:35:28 PM
try:
<link rel="stylesheet" type="text/javascript" href="external.js"/>
instead of .css replace it for javascript.

Go to topic 49141

Return to index page 186
Return to index page 185
Return to index page 184
Return to index page 183
Return to index page 182
Return to index page 181
Return to index page 180
Return to index page 179
Return to index page 178
Return to index page 177