473,394 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Problem dynamically loading style sheet

In trying to load a style sheet via JavaScript I ran into a problem...the
style sheet doesn't load. This simple task has turned into a vexing problem.
Here is the script and html:

<html>
<head>
<title>load a style sheet</title>
<script type="text/javascript" language="JavaScript">
var mystyle="css/mystyle.css";
document.write=("<link rel='stylesheet' href='" + mystyle + "'
type='text/css'>");
</script>
</head>
<body>
<p class="foobar">display some text in the foobar class</p>
</body>
</html>

This is so simple it almost has to work, but it doesn't. I'm suspecting
either the browser is the problem (IE5.5) or maybe it has something to do
with being a local file or both or none of the above...dunno. Can anybody
see anything wrong here?

TIA!
Jul 23 '05 #1
1 2433
In article <a0******************@bignews3.bellsouth.net>, Hank Flowers
<no****@nospam.ca> wrote:
In trying to load a style sheet via JavaScript I ran into a problem...the
style sheet doesn't load. This simple task has turned into a vexing problem.
Here is the script and html:

<html>
<head>
<title>load a style sheet</title>
<script type="text/javascript" language="JavaScript">
var mystyle="css/mystyle.css";
document.write=("<link rel='stylesheet' href='" + mystyle + "'
type='text/css'>");
</script>
</head>
<body>
<p class="foobar">display some text in the foobar class</p>
</body>
</html>

This is so simple it almost has to work, but it doesn't. I'm suspecting
either the browser is the problem (IE5.5) or maybe it has something to do
with being a local file or both or none of the above...dunno. Can anybody
see anything wrong here?

TIA!

It's not document.write=(xxx
It's document.write(xxx
Leave out the equal sign.

--
Dennis M. Marks
http://www.dcs-chico.com/~denmarks/
Replace domain.invalid with dcsi.net
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: alex | last post by:
I'm new to xslt, and I am attempting to use it to produce a comma-separated-value file from a large, dynamically-generated data file formatted in xml (examples of the xml file and my xslt style...
5
by: Janet | last post by:
The following html code appears in an ASP page. The hyperlink is set to white (see the page link color), but when the page renders in IE 6.0, it initially appears in maroon with a white border...
1
by: Kleist | last post by:
Hi! The XML document is created dynamically. I need to convert it in PDF format. Actually, this is a huge table with data. I don`t know in advance, how much columns it will have. I apply XSL-FO...
4
by: Wilhelm Kutting | last post by:
Hello i have the following Unordered List with the shown stylesheet definiton (out of mambo cms). What i like to have is that page 3 is shown with circle-full.gif but that didn't work out. Can...
1
by: Kamal Jeet Singh | last post by:
Hi Friends !! I am facing problem in controlling the dynamically created controls on web page. The problem Scenario is Scenario:- My requirement is to load the web user controls on the web...
0
by: JohnK82 | last post by:
Hi guys I have a webcontrol that displays an article in multiple parts. You can jump back and forward between the parts (I call them sheets) by clicking on a label. Each sheet has a label. The...
2
by: davidson1 | last post by:
Hai friends..for menu to use in my website..i found in one website....pl look below website.... http://www.dynamicdrive.com/dynamicindex1/omnislide/index.htm i downloaded 2 files.... ...
6
by: _Who | last post by:
I use the code below to change to a style sheet that has: body { ....
1
by: neovantage | last post by:
Hey all, I am using a PHP script which creates headings at run time in a sense at page execution. I am stuck a with a very little problem which i am sure i will have the solution from experts. ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.