Home >Web Front-end >JS Tutorial >How jQuery controls frames and frame page JS_jquery
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>
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.