clearInterval() : iframe & window communication problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gskoli
    New Member
    • May 2010
    • 23

    clearInterval() : iframe & window communication problem

    Dear all,
    I have given snippet of code in that it is cgi file in which i am using iframe , source of iframe is calling another cgi file.
    JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
    Code:
          this is ABC.cgi file
          <script type="text/javascript">
          function interval_setting(){ _clear = 5; _clear =  setInterval("xmlhttpPost11('index.cgi','tracker_shower','Latest_frame','Tracker_loader',_clear,'','','')",20000);}
          </script>
       
          <body bgcolor="#FFFFFF"onLoad='interval_setting();'>
          <td bgcolor="#ffffff" height="75">
             <div id = "Tracker_loader" align = 'center' style = "display:none"><img src='/images/ajax-loader.gif'></div>
     
            <iframe id= "Latest_frame" src="bidsupdate.cgi?TYPE=$type" scrolling="no" frameborder="0" height=100% width=100%>
            </iframe>
          </td>
    
    this is ABC.cgi file <script type="text/javascript"> function interval_setting(){ _clear = 5; _clear = setInterval("xmlhttpPost11('index.cgi','tracker_shower','Latest_frame','Tracker_loader',_clear,'','','')",20000);} </script> <body bgcolor="#FFFFFF"onLoad='interval_setting();'> <td bgcolor="#ffffff" height="75"> <div id = "Tracker_loader" align = 'center' style = "display:none"><img src='/images/ajax-loader.gif'></div> <iframe id= "Latest_frame" src="bidsupdate.cgi?TYPE=$type" scrolling="no" frameborder="0" height=100% width=100%> </iframe> </td>
    now setInterval function calling xmlhttpPost11() that function is actually a ajax function which is Reloading this iframe(Latest_f rame).
    now in bidsupdate.cgi i met a condition where i need to stop this setInterval()
    but how i can do that ....
    can i write some code in bidsupdate.cgi file to clearInterval But how ....

    waiting for reply
    thanks in advance
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    basically you would need to clear the interval in the parent frame/window ... so from you iframe-source you would need to do something like:

    Code:
    parent.clearInterval(_clear);

    Comment

    • gskoli
      New Member
      • May 2010
      • 23

      #3
      Can i use
      Code:
      parent.window.clearInterval()
      And one more thing to accessing global variable it was giving me error
      so i have written like
      Code:
      parent.window.clearInterval(parent.window._clear)
      and now it is working .

      Thanks a lot ...

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5390

        #4
        of course :) ... just gave it as an example ... even:
        Code:
        parent.clearInterval(parent._clear);
        should have worked ... parent refers to the window already ...

        kind regards

        Comment

        • gskoli
          New Member
          • May 2010
          • 23

          #5
          Ya thanks ...

          Comment

          Working...