why doesnt ONCLICK work from some machines?

A

Andrew

Hi all

Are there any compatibilty issues associated with teh following command?

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

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

Thanks

atskud
 
R

Richard Cornford

Andrew said:
Hi all

Are there any compatibilty issues associated with
teh following command?

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

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

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.
 
K

kaeli

Hi all

Are there any compatibilty issues associated with teh following command?

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

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

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!
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top