Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > why doesnt ONCLICK work from some machines?

Reply
Thread Tools

why doesnt ONCLICK work from some machines?

 
 
Andrew
Guest
Posts: n/a
 
      07-27-2004
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
 
Reply With Quote
 
 
 
 
Richard Cornford
Guest
Posts: n/a
 
      07-27-2004
Andrew wrote:
> 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.


 
Reply With Quote
 
 
 
 
kaeli
Guest
Posts: n/a
 
      07-27-2004
In article <(E-Mail Removed) >,
http://www.velocityreviews.com/forums/(E-Mail Removed) enlightened us with...
> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
sort list doesnt work, key=str still doesnt work notnorwegian@yahoo.se Python 3 05-27-2008 04:32 AM
jsf core tag <f:param> doesnt work with <h:commandButton> but work with <h:commandLink> Janaka Perera Java 0 10-29-2007 08:10 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
PC doesnt boot first time and doesnt shutdown dann Computer Support 6 08-21-2006 07:31 AM
Why doesnt the Mcp link work? why dosnt the MCP link work? MCSE 10 04-20-2004 06:01 AM



Advertisments