debugging a line of code

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

    debugging a line of code

    Hi,

    I think i made a mistake somewhere.... I can execute the following line
    of code with Firefox but not IE... someone pls help!

    <a href="#" onclick="window .open('video.ht ml', 'Concert 2003: I
    Remember...','w idth=378, height=250, left=500, top=160'); return false;">

    If i only use the first part, both can execute it correctly...
    e.g.

    <a href="#" onclick="window .open('video.ht ml');">

    Thank you in advance...
  • Mick White

    #2
    Re: debugging a line of code

    terry wrote:
    [color=blue]
    > Hi,
    >
    > I think i made a mistake somewhere.... I can execute the following line
    > of code with Firefox but not IE... someone pls help!
    >
    > <a href="#" onclick="window .open('video.ht ml', 'Concert 2003: I
    > Remember...','w idth=378, height=250, left=500, top=160'); return false;">[/color]

    The browser may be complaining about white space in the third parameter.

    'width=378,heig ht=250,left=500 ,top=160'

    Try that.
    Mick[color=blue]
    >
    > If i only use the first part, both can execute it correctly...
    > e.g.
    >
    > <a href="#" onclick="window .open('video.ht ml');">
    >
    > Thank you in advance...[/color]

    Comment

    • terry

      #3
      Re: debugging a line of code

      Mick White wrote:
      [color=blue]
      > terry wrote:
      >[color=green]
      >> Hi,
      >>
      >> I think i made a mistake somewhere.... I can execute the following
      >> line of code with Firefox but not IE... someone pls help!
      >>
      >> <a href="#" onclick="window .open('video.ht ml', 'Concert 2003: I
      >> Remember...','w idth=378, height=250, left=500, top=160'); return false;">[/color]
      >
      >
      > The browser may be complaining about white space in the third parameter.
      >
      > 'width=378,heig ht=250,left=500 ,top=160'
      >
      > Try that.
      > Mick
      >[/color]
      Thank you for you reply...
      but still doesn't work..
      IE status still shows 'error on page' after i click on the link. And
      nothing happens after that..[color=blue][color=green]
      >>
      >> If i only use the first part, both can execute it correctly...
      >> e.g.
      >>
      >> <a href="#" onclick="window .open('video.ht ml');">
      >>
      >> Thank you in advance...[/color][/color]

      Comment

      • Mick White

        #4
        Re: debugging a line of code

        terry wrote:
        [color=blue]
        > Mick White wrote:
        >[color=green]
        >> terry wrote:[/color][/color]
        [color=blue][color=green][color=darkred]
        >>>
        >>> <a href="#" onclick="window .open('video.ht ml', 'Concert 2003: I
        >>> Remember...','w idth=378, height=250, left=500, top=160'); return
        >>> false;">[/color]
        >> The browser may be complaining about white space in the third parameter.
        >>
        >> 'width=378,heig ht=250,left=500 ,top=160'
        >>
        >> Try that.
        >> Mick
        >>[/color]
        > Thank you for you reply...
        > but still doesn't work..
        > IE status still shows 'error on page' after i click on the link. And
        > nothing happens after that..
        >[/color]

        The error is in "video.html " then.
        Mick

        Comment

        • Lee

          #5
          Re: debugging a line of code

          terry said:[color=blue]
          >
          >Hi,
          >
          >I think i made a mistake somewhere.... I can execute the following line
          >of code with Firefox but not IE... someone pls help!
          >
          ><a href="#" onclick="window .open('video.ht ml', 'Concert 2003: I
          >Remember...',' width=378, height=250, left=500, top=160'); return false;">
          >
          >If i only use the first part, both can execute it correctly...
          >e.g.
          >
          ><a href="#" onclick="window .open('video.ht ml');">[/color]

          You seem to have confused the window name attribute for
          a window title. The second argument to window.open() may
          not contain spaces or the ":" character. The value will
          not be visible.

          Comment

          • terry

            #6
            Re: debugging a line of code

            Mick White wrote:
            [color=blue]
            > terry wrote:
            >[color=green]
            >> Mick White wrote:
            >>[color=darkred]
            >>> terry wrote:[/color][/color]
            >
            >[color=green][color=darkred]
            >>>>
            >>>> <a href="#" onclick="window .open('video.ht ml', 'Concert 2003: I
            >>>> Remember...','w idth=378, height=250, left=500, top=160'); return
            >>>> false;">
            >>>
            >>> The browser may be complaining about white space in the third parameter.
            >>>
            >>> 'width=378,heig ht=250,left=500 ,top=160'
            >>>
            >>> Try that.
            >>> Mick
            >>>[/color]
            >> Thank you for you reply...
            >> but still doesn't work..
            >> IE status still shows 'error on page' after i click on the link. And
            >> nothing happens after that..
            >>[/color]
            >
            > The error is in "video.html " then.
            > Mick[/color]
            ha, I have figured it out with your help...
            the 2nd parameter 'Concert 2003: I Remember...' cannot have any space in
            between... so i changed it to 'concert' and it works magic :)

            Thank you :D

            Comment

            • Martin Honnen

              #7
              Re: debugging a line of code



              terry wrote:

              [color=blue]
              > I think i made a mistake somewhere.... I can execute the following line
              > of code with Firefox but not IE... someone pls help!
              >
              > <a href="#" onclick="window .open('video.ht ml', 'Concert 2003: I
              > Remember...','w idth=378, height=250, left=500, top=160'); return false;">[/color]

              You should tell us what IE does, if it gives you an error message, what
              that message is.
              Without that I can only assume that the second argument is the problem,
              it should not contain spaces so try
              window.open('vi deo.html', 'Concert2003', 'width...');
              however you should better write the whole link as
              <a href="video.htm l"
              target="Concert 2003"
              onclick="window .open(this.href , this.target,
              'width=378,heig ht=250,...'); return false;">link text</a>

              --

              Martin Honnen


              Comment

              • Grant Wagner

                #8
                Re: debugging a line of code

                terry wrote:
                [color=blue]
                > Mick White wrote:
                >[color=green]
                > > terry wrote:
                > >[color=darkred]
                > >> Hi,
                > >>
                > >> I think i made a mistake somewhere.... I can execute the following
                > >> line of code with Firefox but not IE... someone pls help!
                > >>
                > >> <a href="#" onclick="window .open('video.ht ml', 'Concert 2003: I
                > >> Remember...','w idth=378, height=250, left=500, top=160'); return false;">[/color]
                > >
                > >
                > > The browser may be complaining about white space in the third parameter.
                > >
                > > 'width=378,heig ht=250,left=500 ,top=160'
                > >
                > > Try that.
                > > Mick
                > >[/color]
                > Thank you for you reply...
                > but still doesn't work..
                > IE status still shows 'error on page' after i click on the link. And
                > nothing happens after that..[/color]

                Internet Explorer does not like whitespace in the window name (2nd parameter).
                The second parameter of window.open() isn't the title of the new window, it is
                the window's name. The specs may say otherwise, but I never use a window name
                outside the set of characters including [a-zA-Z0-9_] and I never have any
                problems.

                Other browsers have problems with whitespace in the 3rd parameter, so remove
                that as well.

                Change your code to be:

                <a href="video.htm l" target="Concert 2003"
                onclick="
                window.open(
                this.href,
                this.target,
                'width=378,heig ht=250,left=500 ,top=160');
                return false;
                ">

                Note that I moved the URL into the HREF attribute and refer to it as this.href
                in the window.open() call, and moved the window name to the TARGET attribute and
                removed all whitespace and special characters, then referred to it in the
                window.open() as this.target.

                This has the added benefit of creating a working link for people who do not have
                JavaScript enabled, and it makes it easier to maintain because you simply edit
                the <A> and change the HREF attribute as you would any other link.

                --
                Grant Wagner <gwagner@agrico reunited.com>
                comp.lang.javas cript FAQ - http://jibbering.com/faq

                Comment

                Working...