Hi,
There's something I really don't understant, if somebody could help me : in the 
javascript code David sent, if I add an alert in the 'all' function : 

if (evt.type=="click"){
 alert(evt.target.nodeName);
}
else{
 alert(evt.type);
 evt.currentTarget.firstChild.nextSibling.setAttributeNS(null,"fill" ,"red")
}

then I have the following alerts : 'mousedown', 'mouseup' and the circle turns 
red.
If I comment the "alert(evt.type)", I have the alert : 'circle' and the circle 
turns red.
Could someone explain to me why this only line makes the "click" not fired 
anymore ??
Thanks in advance.



________________________________
De : "Dailey, David P." <[EMAIL PROTECTED]>
À : svg-developers@yahoogroups.com
Envoyé le : Mercredi, 3 Décembre 2008, 18h29mn 48s
Objet : RE: [svg-developers] onmousedown() and onclick() at the same time


Take a look at the following; it lets different events on parts of the group be 
registered and responded to.

Hope it helps

David

<svg xmlns="http://www.w3. org/2000/ svg" width="100%"

xmlns:xlink= "http://www.w3. org/1999/ xlink" 

> 

<script><![CDATA[

xmlns="http://www.w3. org/2000/ svg"

xlink="http://www.w3. org/1999/ xlink" 

function all(evt){

if (evt.type==" click") alert(evt.target. nodeName)

else evt.currentTarget. firstChild. nextSibling. setAttributeNS( null,"fill" 
,"red")

}

//]]>

</script>

<g onmousedown= "all(evt) ;" onmouseup="all( evt)">

<circle onclick="all( evt)" fill="black" r="5" cx="55" cy="55"/>

<circle onclick="all( evt)" fill="black" r="5" cx="100" cy="100"/>

</g>

</svg>

From: svg-developers@ yahoogroups. com [mailto:svg-developers@ yahoogroups. 
com] On Behalf Of jgfa92004
Sent: Wednesday, December 03, 2008 6:07 AM
To: svg-developers@ yahoogroups. com
Subject: [svg-developers] onmousedown( ) and onclick() at the same time

Hi,

I have the following svg code : 

<g onmousedown= "down(evt) ;" onmouseup="up( evt);">
<circle onclick="alert( 'circle1' )" fill="black" r="5" cx="5" cy="5"/>
<circle onclick="alert( 'circle2' )" fill="black" r="5" cx="0" cy="0"/>
</g>

My problème is that the onclick event is never called, apparently 
because of the onmousedown and onmouseup events called in the first g.
What should I do to be able to call another function when a circle is 
clicked ?
Thanks a lot.

[Non-text portions of this message have been removed]

 


      

[Non-text portions of this message have been removed]


------------------------------------

-----
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/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/svg-developers/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> 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/

Reply via email to