Web Analytics Made Easy -
StatCounter self.location and Netscape - CodingForum

Announcement

Collapse
No announcement yet.

self.location and Netscape

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • self.location and Netscape

    I'm having problems using a named anchor in the following code:

    Code:
    <script language="Javascript">
    <!--
    window.self.location='#message';
    //-->
    </script>
    This works fine in IE but dosen't in NS. In NS the page stops loading at the point it reaches the JS code.

    There's a simple answer, I bet, but I'm not on top of JS so your solution would be a grate help.


  • #2
    you should try putting that in an onload statement. i think the problem is that the anchor doesnt exist yet when the browser reaches that code so it has no where to send you to. if you call that code when the page is loaded it should work because all the elements have been loaded.

    Code:
    <script language="Javascript">
    <!--
    window.onload=function(){window.self.location='#message';}
    //-->
    </script>
    eak | "Doing a good deed is like wetting your pants; every one can see the results, but only you can feel the warmth."

    Comment


    • #3
      BTW, window.self is redundant:

      self == window //true

      Which means you are saying window.window, and:

      window.window == window //true

      So a:

      self.location.href
      or a
      window.location.href
      is all that is needed, or you could even just go:
      location.href

      As window is the top-level object anyway.
      jasonkarldavis.com

      Comment

      Working...
      X