SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Nov 2005
    Location
    Southern Nevada, USA
    Posts
    150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Switch CSS style sheets with javascript

    Can anyone tell me why this code does not work in IE6?
    Code:
    <script type="text/javascript">
    var width = screen.width;
    if (width > 1000)
    {
    document.write("<link rel='StyleSheet' href='wide.css' type='text/css' media='screen'/>");
    }
    else
    {
    document.write("<link rel='StyleSheet' href='narrow.css' type='text/css' media='screen'/>");
    }
    </script>
    It works fine in IE7 and Firefox.

    I will appreciate any help I can get as I can't figure this one out.

    Lawrence

  2. #2
    SitePoint Zealot
    Join Date
    Nov 2005
    Location
    Southern Nevada, USA
    Posts
    150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Sorry about this.....

    I just found this part of the code is working. It is something in one of my CSS files that is not working in IE6.

    Lawrence


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •