onclick

gary
04-11-2004, 02:21 PM
cant get onclick button to work,

want to click on "eyeLast" triangle, and change colour of "eye1" circle. its something easy no doubt but don't have debugger to help. Anyone know this?


<script language="JavaScript">

function changeColour() {

eye1.style="fill:red"
}

</script>

<path id="eyeLast" onclick="changeColour()"
d="M 80 70 L 60 85 80 100 z"
style="stroke:black; stroke-width:3; fill:blue" />


<circle id="eye1" cx="520" cy="300" r="20" style="fill:blue" />

Anonymous
04-12-2004, 01:04 AM
Try this

<script language="JavaScript">
function changeColour(evt) {
eye1 = evt.target.ownerDocument.getElementById("eye1")
eye1.style.setProperty("fill","red")
}
</script>

<path id="eyeLast" onclick="changeColour(evt)"
d="M 80 70 L 60 85 80 100 z"
style="stroke:black; stroke-width:3; fill:blue" />
<circle id="eye1" cx="520" cy="300" r="20" style="fill:blue" />

See
http://www.learnsvg.com/tutorial2/example/setProperty.svg

Michel

 
Web mp2kmag.com
mapforums.com

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum