473,699 Members | 2,416 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="JavaS cript">
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 2445
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="JavaS cript">
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
1601
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 sheet follow). It works pretty well, but xsltproc takes an extremely long time to process the data file when it grows fairly large (>1MB). I've read that using keys can improve processing time on large documents, however I don't know the number of...
5
2696
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 around it. When the user clicks anywhere on the page, it turns white. Does anybody know how I can make it appear white when the page first renders? Response.Write("<html><body bgcolor=""#000000"" link=""#FFFFFF"" vlink=""#FFFFFF"">")
1
1582
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 style-sheet. And use table-layout=auto property of the table. But the problem is that is seems to me that table is created with the same column width taken to fill the table like ( column-width = table-width / col.number). And contents of some...
4
1579
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 someone paste me a good explaining url or a solution for me? <ul id="mainlevel"> <li><a href="page1" class="mainlevel">Page1</a></li> <li><a href="page2" class="mainlevel">Page2</a></li> <li><a href="page3" class="mainlevel"...
1
2572
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 page dynamically. To do this, First I including a web page (MainPage.aspx) and I made form tag to Runat=Server. I included one table tag and also made this table Runat=Server side. Second I created three Web User Controls e.g. wucCustomerInfo.ascx,
0
1152
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 control is used like this: <john:MyControl runat="server"> <john:Sheet label="Intro"> This is the first part of the text... </john:Sheet>
2
2457
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.... menuitems.js mmenu.js
6
2553
by: _Who | last post by:
I use the code below to change to a style sheet that has: body { ....
1
3389
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. The problem is when it creates transparent PNG format image then and it pixel ate the image. e.g. If i am using a gradient in background then it vary in color range. Now when i used that php script it generates image successfully but it pixel ate...
0
8691
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9180
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9038
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8920
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8887
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6536
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4633
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2351
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.