clearInterval - Problem

E

emerson

To all,

I posted this question in svg group twice already - and got no answer.

Q: why does the animation not stop when a height of 10 is reached ?




<?xml version="1.0"?>
<svg width="1280" height="800">
<script type="text/javascript">

<![CDATA[

var height = 0;
var timer1;

function startAction()
{
timer1 = setInterval("doIpl()",500 )
}

function doIpl()
{
obj = svgDocument.getElementById( "rect11" );
obj.setAttribute("height", height);
height = height + 1

if ( height == 10 )
{
stop();
}

}

function stop()
{
clearInterval(timer1);
alert(height);
}




]]>
</script>

<g>

<rect id="rect12" x="190" y="55" width="100" height="65"
fill="lightgrey"
stroke-width="1" stroke="black" />
<text x="200" y="70" font-size="12">SAG_BCPII</text>

<rect id="rect11" x="190" y="55" width="100" height="65" fill="pink"
stroke-width="1" stroke="black" />
<text x="200" y="70" font-size="12">SAG_BCPII</text>


<!--*******************************************************************
-->


<rect onclick="startAction()" x="100" y="450" width="10" height="10"
fill="pink" stroke-width="1" stroke="black" />
<text x="110" y="475" text-anchor="middle">Start</text>

<rect onclick="stop()" x="65" y="450" width="10" height="10"
fill="pink" stroke-width="1" stroke="black" />
<text x="65" y="475" text-anchor="middle">Stop</text>





</g>
</svg>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top