Home > Web Front-end > JS Tutorial > How jQuery controls frames and frame page JS_jquery

How jQuery controls frames and frame page JS_jquery

WBOY
Release: 2016-05-16 15:11:43
Original
1253 people have browsed it

The example in this article describes the method of jQuery controlling frames and frame page JS. Share it with everyone for your reference, the details are as follows:

<script src="jquery-1.3.2.min.js" type="text/javascript" ></script>
<script>
var _intervalx,steplengthx
steplengthx=1000; //第一次触发时间
nextstepx=10000 ; //以后的触发时间
$(document).ready(function(){
 _intervalx=setInterval("CheckUser()",steplengthx);
});
function CheckUser() //发送查找程序
{
  if(parent.frames["frmMain"].location.pathname!="/SysMan/user_agent.asp") //如果是在user_agent.asp页面下就不提示
  {
   $.post("../webchat/chat.asp",{"action":"checkuser"},function(data)//初始化留言
   {
    if(parseInt(data)>0) //
    {
      if($(window.parent.frames["frmMain"].document).find("#message").length<1) //如果页面已经添加就不再添加
      {
      var messages="<div id=message><ul><li>有新客户发出客服申请</li><li><a href=../SysMan/user_agent.asp target=_self>在线客服</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秒关闭
}
</script>

Copy after login

Readers who are interested in more jQuery-related content can check out the special topics on this site: "JQuery drag effects and skills summary", "jQuery extension skills summary", "JQuery common classic special effects summary", "jQuery animation and special effects usage summary", "jquery selector usage summary" and "jQuery common plug-ins and usage Summary

I hope this article will be helpful to everyone in jQuery programming.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template