hi,
 
I have an SVG image of a dice that, when clicked, changes the stroke of the dice to yellow and back again.
 
im trying to get the stroke of a rectangle to change when i click on it and anything inside it (i.e. the dots of the dice).
The code i have at the moment is:
 
<SVG>
<script type="text/ecmascript">
 
var click = 0;
function hold(evt)
{
 if(click%2==0) evt.target.setAttribute('stroke', 'yellow');
 if(click%2!=0) evt.target.setAttribute('stroke', '#DD1212');
 click++;
}
</script>
 
<g id="dice">

<rect id="DiceRect" x="0" y="0" rx="5" ry="5" height="40" width="40" fill="#DD1212"  stroke="#DD1212" stroke-width="2" />

<circle cx="20" cy="20" r="3" />

</g>
</SVG>
 
How could i change the ecmascript so that if i put the onclick event in the <g> tag like: <g id="dice" >, i could change the colour of the rectangle even if i click on the dot in the rectangle?
 
Would it be something like document.????.setAttribute('stroke', 'yellow') or something? I can't figure this out.
 
So what i'm asking is, how could i change my code so that if i click on any part of the dice (rect or circle) the stroke of the rectangle will change?
 
Thanks
Claire :)


Chat with friends online - download MSN Messenger today. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to