Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #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"
    "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.
  #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
Default

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


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





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