IE 6.0 Javascript Question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Burak

    IE 6.0 Javascript Question

    Hello,

    I have an index.html file as follows

    <html>
    <head>
    <meta http-equiv="content-type" content="text/html;
    charset=iso-8859-1" />
    <title>Career OneStop Coach</title>
    window.location .hostname.toStr ing().split('.' ).slice(-2).join('.');</script>
    <!-- //
    function frameRedirect() {
    var defaultURL =
    "http://newcoach.career onestopcoach.or g";
    var location = top.location.se arch.toString() ;
    var path = '/'
    if ( location ) { path = location.split( '=')[1]; }
    document.getEle mentById('Onlin eCoachFrame').s rc
    = defaultURL + path; */
    }
    // -->
    </script>
    </head>
    <frameset id="ExteriorFra me" rows="0,*">
    <frame src="/empty.html" name="Empty"
    scrolling="none " noresize="nores ize" frameborder="0"
    />
    <frameset id="InteriorFra me"
    cols="*,300">
    <frame
    src="http://www.careeronest op.org" name="Content"
    scrolling="auto " />
    <frame
    src="http://newcoach.career onestopcoach.or g"
    id="OnlineCoach Frame" name="OnlineCoa ch"
    scrolling="auto " frameborder="1" />
    </frameset>
    </frameset>

    </html>

    And empty.html has

    <html>
    <head>
    <!-- //
    document.domain =
    window.location .hostname.toStr ing().split('.' ).slice(-2).join('.');
    // -->
    </script>
    </head>
    <body onfiltered="_ja vascript: top.frameRedire ct()">
    <body>

    </body>
    </html>

    When I try to bring up this page in IE 6.0 I get an
    error message complaining about the _javascript
    function
    frameRedirect. No matter what's in that function, the
    browser complains.

    When I comment out the <body onfiltered=...> , the page
    comes up fine.

    How can I fix this problem?

    Thank you,

    Burak
  • Michael Winter

    #2
    Re: IE 6.0 Javascript Question

    On 1 Nov 2004 10:56:02 -0800, Burak <burak.gunay@xp andcorp.com> wrote:

    [snip]
    [color=blue]
    > window.location .hostname.toStr ing().split('.' ).slice(-2).join('.');</script>[/color]

    This is nonsense, as is the similar start later in your code. Validate
    (<URL:http://validator.w3.or g/>) your HTML.

    By the way, location.hostna me *is* a string, so toString() is redundant.
    [color=blue]
    > <!-- //[/color]

    Hiding scripts is an obsolete practice. All browsers now in use know what
    a SCRIPT element is, even if they are incapable of executing the contents.
    If, for some reason, there is something you need to hide the script from,
    move it into an external file.

    [snip]
    [color=blue]
    > var location = top.location.se arch.toString() ;[/color]

    The location.search property is a string, so again, toString() is
    redundant.

    [snip]
    [color=blue]
    > <body onfiltered="_ja vascript: top.frameRedire ct()">[/color]

    What exactly is "_javascrip t:" supposed to do?

    [snip]

    Mike

    --
    Michael Winter
    Replace ".invalid" with ".uk" to reply by e-mail.

    Comment

    • Mark Preston

      #3
      Re: IE 6.0 Javascript Question

      Burak wrote:
      [color=blue]
      > I have an index.html file as follows
      >
      > <html>
      > [snip]
      > window.location .hostname.toStr ing().split('.' ).slice(-2).join('.');</script>[/color]

      I'm sure someone else will also point out that "location.hostn ame" is
      already a String and does not need converting to one. As to the "split",
      "slice" and "join" - I honestly have no idea what you are trying to
      achieve here. It seems pointless - if it does anything at all.
      [color=blue]
      > <!-- //[/color]

      You don't need to comment out scripts any more. If you do comment them
      out though, you should also use the CDATA comment to make sure it also
      works if the page is parsed as XHTML rather than just HTML.
      [color=blue]
      > function frameRedirect() {
      > [snip]
      > <body onfiltered="_ja vascript: top.frameRedire ct()">
      > <body>[/color]

      This is where I get truly confused. What exactly is "_javascrip t:"
      supposed to do? I will admit that I have never used the "onfiltered ="
      attribute and am not familiar with that either, but I think the
      underscore is redundant anyway.

      More oddly, you appear to have a body element containing another body
      element and yet only close one of them.

      Comment

      • Burak Gunay

        #4
        Re: IE 6.0 Javascript Question


        Thank you for all your help. I didn't write this code, a coworker
        emailed it to me to see if I could figure out what was wrong with it.

        Burak



        *** Sent via Developersdex http://www.developersdex.com ***
        Don't just participate in USENET...get rewarded for it!

        Comment

        • Andrew Thompson

          #5
          Re: IE 6.0 Javascript Question

          On 03 Nov 2004 14:17:04 GMT, Burak Gunay wrote:
          [color=blue]
          > Thank you for all your help. I didn't write this code, a coworker
          > emailed it to me to see if I could figure out what was wrong with it.[/color]

          (earlier)[color=blue]
          > How can I fix this problem?[/color]

          Tell your co-worker to start with step 1.
          <http://validator.w3.or g/>

          The HTML is crap. It is invalid. Everything that
          happens beyond that is as good as random.

          --
          Andrew Thompson
          http://www.PhySci.org/codes/ Web & IT Help
          http://www.PhySci.org/ Open-source software suite
          http://www.1point1C.org/ Science & Technology
          http://www.LensEscapes.com/ Images that escape the mundane

          Comment

          Working...