You should use the Event.element(e) instead if e.target to make it
work in all browsers.
On 4/17/07, zio budda <[EMAIL PROTECTED]> wrote:
> Hi. I have this question: I have a page with more ugual "GIF" (say ?/Help
> gif). When I click on one of this giv a "DIV" is showed (one for each gif).
> And when a div is showed the last div "showed" there must "hide". Ok, no
> problem. I have do it. My problem is that the div that is showed in this
> moment must to "hide" when I clink into the document (is not important
> where). Onto firefox I have resolved in this way with the use of Event:
>
> mostraDivHelp(div) {
> //If is there a div "open" I hide it.
> if (SHEEBOO_scambio['divHelp'] !== undefined &&
> SHEEBOO_scambio['divHelp'] != null) {
> $(SHEEBOO_scambio['divHelp']).hide();
> Event.stopObserving(document,'click',function(e) {if
> (e.target.attributes !== undefined) return false;nascondiDivHelp(div);});
> }
>
> SHEEBOO_scambio['divHelp'] = div;
> $(div).setStyle({display:'block'});
> SHEEBOO_scambio['primoClick'] = 0;
> Event.observe(document,'click',function(e) {if (e.target.attributes.alt
> !== undefined) return false;nascondiDivHelp(div);});
> }
>
> function nascondiDivHelp(div) {
> Event.stopObserving(document,'click',function(e) {if
> (e.target.attributes !== undefined) return
> false;SHEEBOO_nascondiDivHelp(div);});
> SHEEBOO_scambio['divHelp'] = null;
> $(div).hide();
> }
>
> It works in FF, but not in IE. In IE the event "e" is always "empty".
>
> Where is my error ? Is there a more beautifull solution ?
>
> Tnx.
>
> Michel.
> --
> Michel 'ZioBudda' Morelli [EMAIL PROTECTED]
> Consulenza sistemistica in ambito OpenSource.
> Sviluppo applicazioni web dinamiche (LAMP+Ajax)
> Telefono: +39-3939890025 -- Fax: +39-0291390660
>
> http://www.ziobudda.net ICQ: 58351764
> http://www.ziobuddalabs.it Skype: zio_budda
> http://www.ajaxblog.it MSN: [EMAIL PROTECTED]
> >
>
--
burnfield.com/martin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---