Loading ...
Sorry, an error occurred while loading the content.

Help wanted - clearInterval()

Expand Messages
  • t02282a
    To all, why doesn t the animation stop if a height of 10 is reached ? why does only pushing the stop button, stop the animation ? Help please. hge
    Message 1 of 1 , Apr 14, 2004
    • 0 Attachment
      To all,

      why doesn't the animation stop if a height of "10" is reached ?
      why does only pushing the stop button, stop the animation ?

      Help please.
      hge




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

      <![CDATA[

      var height = 0;
      var timer;

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

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

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

      }

      function stop()
      {
      clearInterval(timer);
      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="stop()" x="100" y="450" width="10" height="10"
      fill="pink"
      stroke-width="1" stroke="black" />
      <text x="90" y="475">Stop</text>


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


      </g>
      </svg>
    Your message has been successfully submitted and would be delivered to recipients shortly.