why doesnt ONCLICK work from some machines?

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

    why doesnt ONCLICK work from some machines?

    Hi all

    Are there any compatibilty issues associated with teh following command?

    <div onclick="open(' http://www.mysite.com. htm','','')">Ma in page </div

    It worked on a PC butnot on a MAC (bith with IE).

    Thanks

    atskud
  • Richard Cornford

    #2
    Re: why doesnt ONCLICK work from some machines?

    Andrew wrote:[color=blue]
    > Hi all
    >
    > Are there any compatibilty issues associated with
    > teh following command?
    >
    > <div onclick="open(' http://www.mysite.com. htm','','')">Ma in page </div[/color]

    Yes.
    [color=blue]
    > It worked on a PC butnot on a MAC (bith with IE).[/color]

    The unqualified identifier - open -, executed form on event handler,
    will be resolved against the scope chin of the event handler function.
    Browsers construct different custom scope chains for the event handling
    functions that they construct (from attribute strings), and those scope
    chains may or may not include the - document - object, which has an -
    open - method of its own. If Mac IE places the - document - on the DIVs
    onclick handler's scope chain then the method called will be -
    document.open - instead of - window.open -. Not relying on identifier
    resolution against the scope chain when placing code in HTML event
    handling attribute strings avoids the problem (i.e. use - window.open -
    in this case).

    All calls to - window.open - may be subject to pop-up blocking
    mechanisms of various sorts, and thus may not work on all
    machines/configurations even with the same browser.

    Very old browsers (e.g. Netscape <= 4) may not implement onclick
    handlers on normal DIV elements.

    Richard.


    Comment

    • kaeli

      #3
      Re: why doesnt ONCLICK work from some machines?

      In article <aeeabc2a.04072 70324.6e57794e@ posting.google. com>,
      lechymec@yahoo. fr enlightened us with...[color=blue]
      > Hi all
      >
      > Are there any compatibilty issues associated with teh following command?
      >
      > <div onclick="open(' http://www.mysite.com. htm','','')">Ma in page </div
      >
      > It worked on a PC butnot on a MAC (bith with IE).
      >[/color]

      Try
      <div onClick="window .open('http://www.mysite.com/page.htm','','' );">Main
      </div>

      Mac IE may not support just using open without window in front.
      Just a guess. I don't have a Mac to test it on.

      --
      --
      ~kaeli~
      If that phone was up your a$$, maybe you could drive a
      little better!



      Comment

      Working...