Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 24th, 2006, 06:31 PM
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"
     <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
  #2 (permalink)  
Old September 1st, 2006, 04:35 PM
Registered User
Join Date: Aug 2006
Location: , , United Kingdom.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts

<link rel="stylesheet" type="text/javascript" href="external.js"/>
instead of .css replace it for javascript.
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
External JavaScript with XSL NEO1976 XSLT 2 September 5th, 2006 07:19 AM
different external CSS 4 each instance web ctrl GPV BOOK: Professional CSS: Cascading Style Sheets for Web Design 0 December 26th, 2005 02:26 AM
External Javascript indexed by search engines? Sushifiend3000 Javascript 1 November 27th, 2004 09:31 PM
External Javascript to determine Navigation fs22 Javascript How-To 3 May 21st, 2004 03:42 PM

All times are GMT -4. The time now is 07:01 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.