Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Problem dynamically loading style sheet

Reply
Thread Tools

Problem dynamically loading style sheet

 
 
Hank Flowers
Guest
Posts: n/a
 
      04-10-2004
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!


 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Content Page specific style style sheet rshillington@gmail.com ASP .Net 0 07-14-2006 03:45 PM
How to dynamically change the style sheet based on browser type Rob Roberts ASP .Net 2 01-21-2006 12:38 AM
Need help with Style conversion from Style object to Style key/value collection. Ken Varn ASP .Net Building Controls 0 04-26-2004 07:06 PM
FOP - Style Sheet Designer (fonts problem) enerion XML 0 04-13-2004 02:36 PM
Style sheet problem AC HTML 8 04-05-2004 06:00 PM



Advertisments