Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Nov 2002
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    setting a property that has only a getter

    Hi,
    I need to use a seperate external css for EI5+ and NS6+ browsers. I am currently using the following code in the head of my page. It works fine but when the page loads in NS6 it gives the error: "setting a property that has only a getter" in the JavaScript debugger. How can I clear up this error?

    Here's the code that I use:

    <link rel="stylesheet" type="text/css" href="resources/sg7ns.css">
    <script type="text/javascript">
    <!--
    if (document.styleSheets) document.styleSheets[0].href="resources/sg7ie.css"
    // -->
    </script>

    Here's a link to see the page I use the script on. (the page/site is far from finished, mousing over certain links will cause errors that have nothing to do with my problem - also there is some inconsequential Flash that takes some time to load on 56K)

    http://www.totalfocus.org/sevensamples/

    Thanks for taking the time to read this.
    --Chuck

  • #2
    Regular Coder
    Join Date
    Sep 2002
    Location
    Surrey, UK
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts
    probably allowed to set href of an already written stylesheet.
    Could try:
    document.write the stylesheet into the haed conditionally according to which browser

  • #3
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    See here:
    http://www.w3.org/TR/2000/REC-DOM-Le...ets-StyleSheet

    It's a readonly attribute.

    Alternatives:

    document.getElementsByTagName("link").item(0).setAttribute("href", "something.css");

  • #4
    Regular Coder
    Join Date
    Sep 2002
    Location
    self.location
    Posts
    181
    Thanks
    0
    Thanked 0 Times in 0 Posts
    just caught this thread:

    use MS conditional comments - no javascript required:

    <link rel="stylesheet" type="text/css" href="resources/sg7ns.css">

    <!-- all browsers link to the above, only IE 5+ links to the below: declarations will offset those in the first stylesheet-->

    <!--[if gte IE 5]>
    <link rel="stylesheet" type="text/css" href="resources/sg7ie.css">
    <![endif]-->


  •  

    Posting Permissions

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