jQuery control frames and frame page JS method

  • 2021-01-25 07:07:44
  • OfStack

This article illustrates how jQuery controls frames and frame pages JS. To share with you for your reference, as follows:


<script src="jquery-1.3.2.min.js" type="text/javascript" ></script>
<script>
var _intervalx,steplengthx
steplengthx=1000; // The first 1 Secondary trigger time 
nextstepx=10000 ; // Future trigger times 
$(document).ready(function(){
 _intervalx=setInterval("CheckUser()",steplengthx);
});
function CheckUser() // Send finder 
{
  if(parent.frames["frmMain"].location.pathname!="/SysMan/user_agent.asp") // If it is in user_agent.asp It's not prompted under the page 
  {
   $.post("../webchat/chat.asp",{"action":"checkuser"},function(data)// Initialize message 
   {
    if(parseInt(data)>0) //
    {
      if($(window.parent.frames["frmMain"].document).find("#message").length<1) // If the page has been added, don't add it again 
      {
      var messages="<div id=message><ul><li> A new customer has sent a customer service request </li><li><a href=../SysMan/user_agent.asp target=_self> Online customer service </a></li></ul></div>"
      }
      $(window.parent.frames["frmMain"].document).find("body").append(messages)
      $(window.parent.frames["frmMain"].document).find("#message").show();
      TimeOut();
    }
   });
   clearInterval(_intervalx);
   _intervalx=setInterval("CheckUser()",nextstepx);
  }
}
function TimeOut()
{
  setTimeout(function(){$(window.parent.frames["frmMain"].document).find("#message").hide("slow");},5000) //3 Seconds to shut down 
}
</script>

Readers who are interested in more jQuery related content can check out the special features of this site: jQuery Drag Effects and Techniques Summary, jQuery Extended Techniques Summary, jQuery Common Classical Effects Summary, jQuery Animation and Effects Usage Summary, jquery Selection Method Summary and jQuery Common Plugins and Usage Summary

I hope this article is helpful to jQuery program design.


Related articles: