Hi Andr�
I will use this listener for a textbox. If I click on the textbox, an 2
event listeners are added (keypress and click) to the svg root element.
If I click somewhere else in the document, I want to remove the event
listeners.
As Antoine mentioned, an onclick-event and a event listener "click" are
2 different shoes.
Here is my code example:
if (evt.type == "click")
{// does not work!!! - eventlistener cannot be checked
if (evt.currentTarget.nodeName == "svg" &&
document.documentElement.eventListener == "keypress")
{// remove event listeners
document.documentElement.removeEventListener("keypress",this,false);
document.documentElement.removeEventListener("click",this,false);
}
if (evt.currentTarget.nodeName == "g")
{// set event listeners
document.documentElement.addEventListener("keypress",this,false);
document.documentElement.addEventListener("click",this,false);
}
}
Olaf
andr� m. winter wrote:
> hi olaf,
>
> you could check the event attribute's value and decide on that what to
> do next. if the eventhandler (eg. "click") is not definded the according
> attribute (eg. "onclick") should be empty. or am i missing something here?
>
> btw i stopped playing around with eventlisteners and use only the
> according attributes. it's not cleaner but sometimes safer (on asv3).
>
> andr�
>
--
Olaf Schnabel
Department of Cartography
Swiss Federal Institute of Technology (ETH)
ETH Hoenggerberg, CH-8093 Zurich, Switzerland
phone: ++41-44-633 3031
e-mail: [EMAIL PROTECTED]
www: http://www.karto.ethz.ch/schnabel
------------------------ Yahoo! Groups Sponsor --------------------~-->
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/1U_rlB/TM
--------------------------------------------------------------------~->
-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my membership"
----
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/svg-developers/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/