ONCLICK event not firing in IE6

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

    ONCLICK event not firing in IE6

    Hi,

    I've been reading through tons of posts regarding the problems people
    have encountered with getting javascript functions to trigger when
    called from onclick events... But so far, I haven't found a solution
    that works for me...

    I am trying to launch a popup window when the user clicks on an image.

    I have managed to get this to work in IE6 by using an image button
    (ASP.NET), but this failed in Netscape.
    I can now get it to work in Netscape by triggering the window.open
    command from the onclick event attached to an <IMG> or <A> tag.

    But, this doesn't work in IE6.

    The code:

    <a href="" onclick="openFu llWindow();retu rn false;"><IMG
    src="img/space vase web button.jpg"></a>

    DOES NOT work in IE6. the HREF parameter is not ignored due to the
    'return false;' command... The browser reloads the current page (as
    expected) but the javascript procedure 'openFullWindow ()' is never
    called.

    Can anyone provide a solution to my problem?

    I'm kind of new to all these languages...

    Thanks,

    Nick
  • Lasse Reichstein Nielsen

    #2
    Re: ONCLICK event not firing in IE6

    nick.lankester7 2@ntlworld.com (Nick72) writes:
    [color=blue]
    > The code:
    >
    > <a href="" onclick="openFu llWindow();retu rn false;"><IMG
    > src="img/space vase web button.jpg"></a>
    >
    > DOES NOT work in IE6. the HREF parameter is not ignored due to the
    > 'return false;' command...[/color]

    That symptom suggests an error in the OpenFullWindow function. If
    there is a Javascript error prior to the execution of "return false",
    then false is not returned and the link is followed as normal.

    Are there any error messages? (You have set IE to display Javascript
    errors, right? <URL:http://jibbering.com/faq/#FAQ4_43>).

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • nick lankester

      #3
      Re: ONCLICK event not firing in IE6

      Doh! In the tradition of 'only finding the problem once you've asked a
      question on usenet!', I discovered the prob as soon as I hit submit in
      google!

      You were right... The problem was that I had assigned a 'name' parameter
      to the window I was creating using window.open in the openFullWindow( )
      procedure.

      I removed it and hey presto! it all works...
      I don't know why this should have caused a problem, as I read somewhere
      that it was a good idea to always name the windows... ?!?!

      Thanks for your reply,

      Nick

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

      Comment

      • Lasse Reichstein Nielsen

        #4
        Re: ONCLICK event not firing in IE6

        nick lankester <nick.lankester 72@ntlworld.com > writes:
        [color=blue]
        > You were right... The problem was that I had assigned a 'name' parameter
        > to the window I was creating using window.open in the openFullWindow( )
        > procedure.
        >
        > I removed it and hey presto! it all works...
        > I don't know why this should have caused a problem, as I read somewhere
        > that it was a good idea to always name the windows... ?!?![/color]

        Did your name contain a space?

        The window.open function is documented to required the first two
        arguments:
        <URL:http://www.mozilla.org/docs/dom/domref/dom_window_ref7 6.html#1019331>
        In IE, all arguments are optional, but apparently not in Gecko based
        browsers.

        If you don't plan on reusing the window, opening other links into the
        same window, then you don't need to give it a name. You can then just
        give "_blank" as the name argument to the function. That will create
        a new, unnamed window.

        /L
        --
        Lasse Reichstein Nielsen - lrn@hotpop.com
        DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
        'Faith without judgement merely degrades the spirit divine.'

        Comment

        • nick lankester

          #5
          Re: ONCLICK event not firing in IE6

          Ahh, yes... That must have been the problem.

          A short name with no spaces works fine...


          Can you recommend any books or websites that I can use as a reference
          that contain this kind of information?

          At the moment I'm learning by studying other sites, which is sloooow
          going!

          Thanks again,


          Nick


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

          Comment

          • Chris

            #6
            Re: ONCLICK event not firing in IE6

            Otherwise you could use <a href="javascrip t:void(openFull Window())">blah </a>


            "nick lankester" <nick.lankester 72@ntlworld.com > wrote in message
            news:409e3d4d$0 $206$75868355@n ews.frii.net...[color=blue]
            > Ahh, yes... That must have been the problem.
            >
            > A short name with no spaces works fine...
            >
            >
            > Can you recommend any books or websites that I can use as a reference
            > that contain this kind of information?
            >
            > At the moment I'm learning by studying other sites, which is sloooow
            > going!
            >
            > Thanks again,
            >
            >
            > Nick
            >
            >
            > *** Sent via Developersdex http://www.developersdex.com ***
            > Don't just participate in USENET...get rewarded for it![/color]


            Comment

            • Randy Webb

              #7
              Re: ONCLICK event not firing in IE6

              Chris wrote:
              [color=blue]
              > Otherwise you could use <a href="javascrip t:void(openFull Window())">blah </a>[/color]







              --
              Randy
              Chance Favors The Prepared Mind
              comp.lang.javas cript FAQ - http://jibbering.com/faq/

              Comment

              • Robert

                #8
                Re: ONCLICK event not firing in IE6

                In article <409e3d4d$0$206 $75868355@news. frii.net>,
                nick lankester <nick.lankester 72@ntlworld.com > wrote:
                [color=blue]
                > Ahh, yes... That must have been the problem.
                >
                > A short name with no spaces works fine...
                >
                >
                > Can you recommend any books or websites that I can use as a reference
                > that contain this kind of information?
                >[/color]





                Reads:

                3.1 What books cover javascript?

                The only book currently endorsed by c.l.j. regulars is: JavaScript: The
                Definitive Guide, 4th Edition By David Flanagan ISBN:0-596-00048-0

                (Also by David Flanagan: JavaScript Pocket Reference, 2nd Edition. ISBN
                0-596-00411-7 for language and API reference alone).



                Robert

                Comment

                Working...