Jquery.js跟iframe冲突问题

raychen_china 2016-08-25 03:03:00
浏览器的框架是用的iframe分成上左右,子页面调用了Jquery.js,运行程式将子页面嵌套到父页面的iframe时候,界面框架就没了,按浏览器F12查看,就剩下子页面的代码,去掉jquery.js就没事了,求大神指点啊
...全文
327 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
raychen_china 2016-08-25
  • 打赏
  • 举报
回复
引用 12 楼 zeratul1990 的回复:
if (window.top !== window.self) { window.top.location = window.location };
我擦嘞 还真是这个问题 竟然无视了 谢谢了 结贴了
拜一刀 2016-08-25
  • 打赏
  • 举报
回复
if (window.top !== window.self) { window.top.location = window.location };
raychen_china 2016-08-25
  • 打赏
  • 举报
回复
之前用过frameset还有easyui,这次是个小项目,就用这个iframe, 求大神的帮忙,我都是在jquery.js上出现问题,冲突或者不兼容好像,小生不懂啊
raychen_china 2016-08-25
  • 打赏
  • 举报
回复
<a href="/PRMUserInfo.aspx" target="main_right">test</a> 通过这连接 将如下的asp传过去 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PRMUserInfo.aspx.cs" Inherits="PRM.PRMUserInfo" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title></title> <script src="JS/Bootstrap/jquery-1.7.1.min.js" type="text/javascript"></script> <script src="JS/Bootstrap/jquery.dataTables.min.js" type="text/javascript" ></script> <link href="CSS/Includes/Guide.css" type="text/css" rel="stylesheet" /> <link href="CSS/Includes/index.css" type="text/css" rel="stylesheet" /> <link href="CSS/Includes/MasterPage.css" type="text/css" rel="stylesheet" /> </head> <script type="text/javascript"> $(document).ready(function () { // screenCtrl('aspnetForm'); //$('#example').dataTable({ // "oLanguage": { "sSearch": "Search the nominees:" }, // "iDisplayLength": 10, // "aaSorting": [[0, "asc"]] //}); }); if (window.top !== window.self) { window.top.location = window.location }; function screenCtrl(objname) { var screenWidth = 1024; var screenHeight = 768; if (navigator.appName == 'Netscape') { screenWidth = screen.availWidth - 195; //屏幕宽度 screenHeight = screen.availHeight - 50; //屏幕高度 } else if (navigator.appName == 'Microsoft Internet Explorer') { screenWidth = screen.width - 205; //屏幕宽度 screenHeight = screen.height - 50; //屏幕高度 } // document.getElementById(objname).style.width = screen.width - 15 + 'px'; } </script> <body id="MasterPagebody"> <form name="aspnetForm" method="post" runat="server" id="aspnetForm"> <div> <table style="width: 100%;" cellpadding="2" cellspacing="1" class="border"> <tr> <td style="width: 80px" align="left" class="tdbg"> <b>搜索选项:</b> </td> <td class="tdbg"> <select name="DrpSearchType0" size="1"> <option selected value="0">客户编号</option> <option value="1">客户名称</option> <option value="2">简称</option> </select> <select name="DrpSearchType1" size="1"> <option selected value="0">包含</option> <option value="1">不包含</option> <option value="2">大于</option> </select> <input name="TxtSearchKeyword" type="text" class="inputtext" /> <input type="submit" name="BtnSearch" value="简单查找" id="BtnSearch" class="inputbutton" onmouseover="this.className='inputbutton_hover'" onmouseout="this.className='inputbutton'" /> <input type="submit" name="BtnSearch0" value="模糊查找" id="BtnSearch0" class="inputbutton" onmouseover="this.className='inputbutton_hover'" onmouseout="this.className='inputbutton'" /> <input type="submit" name="BtnSearch1" value="查出全部" id="BtnSearch1" class="inputbutton" onmouseover="this.className='inputbutton_hover'" onmouseout="this.className='inputbutton'" /></td> <td class="tdbg">  </td> </tr> </table><br /> <br /> <table border="0" cellpadding="0" cellspacing="1" style="width: 100%; height: 100%;"> <tr> <td style="width: 140px;"> <input type="checkbox" />选中本页所有信息</td> <td> <input type="submit" name="EBtnBatchDelete" value="批量删除" class="inputbutton" onmouseover="this.className='inputbutton_hover'" onmouseout="this.className='inputbutton'" /></td> </tr> </table> </div> <br /> <div> </div></form> </body> </html>
raychen_china 2016-08-25
  • 打赏
  • 举报
回复
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="PRM.Index" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title>绩效考核系统</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <script src="JS/Bootstrap/jquery-1.7.1.min.js" type="text/javascript"></script> <script language="javascript" src="JS/Includes/jquery.pack.js" type="text/javascript"></script> <script language="javascript" src="JS/Includes/AdminIndex.js" type="text/javascript"></script> <script language="javascript" src="JS/Includes/FrameTab.js" type="text/javascript"></script> <link href="CSS/Includes/Guide.css" type="text/css" rel="stylesheet" /> <link href="CSS/Includes/index.css" type="text/css" rel="stylesheet" /> <link href="CSS/Includes/MasterPage.css" type="text/css" rel="stylesheet" /> <script type="text/javascript"> $(document).ready(function () { screenCtrl('myform'); }); if (window.top !== window.self) { window.top.location = window.location }; function screenCtrl(objname) { var screenWidth = 1024; var screenHeight = 768; if (navigator.appName == 'Netscape') { screenWidth = screen.availWidth-195; //屏幕宽度 screenHeight = screen.availHeight - 50; //屏幕高度 } else if (navigator.appName == 'Microsoft Internet Explorer') { screenWidth = screen.width-205; //屏幕宽度 screenHeight = screen.height - 50; //屏幕高度 } document.getElementById(objname).style.height = screenHeight-50 + 'px'; document.getElementById(objname).style.width = screenWidth-5 + 'px'; document.getElementById("left").style.height = screenHeight-50 + 'px'; document.getElementById("main_right").style.height = screenHeight - 50 + 'px'; document.getElementById("main_right").style.width = screenWidth - 15 + 'px'; document.getElementById("SubMenu").style.width = screenWidth - 15 + 'px'; } </script> </head> <body id="Indexbody" > <form id="myform" name="myform" method="post" runat="server"> <table cellspacing="0" cellpadding="0" border="0" > <tbody> <tr > <td colspan="3"> <div id="content"> <div id="ChannelMenuItems" style="padding-left:15px; "> </div> <div id="SubMenu"> <div id="ChannelMenu_" style="width: 100%; "> <ul> <li style="PADDING-RIGHT: 7px; PADDING-LEFT: 7px; ">管理员:<span class="AdminName"><strong><%=loginname %></strong></span>,欢迎您!</li> <li style="width:75%"> </li> <li style="PADDING-RIGHT: 12px; PADDING-LEFT: 12px; "><a href="#" title="咨询IT">使用帮助</a> </li> <li style="PADDING-RIGHT: 12px; PADDING-LEFT: 12px; "><a href="mailto:Bonnie_Hu1@jabil.com" title="电话:3671">联系我们</a> </li> <li style="PADDING-RIGHT: 12px; PADDING-LEFT: 12px; "><a href="Login.aspx"><span class="SignOut">安全退出</span></a> </li> </ul> </div> </div> <marquee scrollamount="4" behavior="alternate" bgcolor=" #F5DEB3" > <img alt="公告" src="Images/notic.png" width="18px" height="14px" /><a style="font-family: 宋体; font-size: 13px; font-weight: bolder; vertical-align: middle; color:red">公告:</a><span style="color: #0000FF;"><asp:Label ID="publictext" runat="server" Font-Size="Larger" Font-Names="宋体" Text="本次绩效考核截至于2016年9月,请各位人员注意!!"></asp:Label></span> </marquee> </div> </td> </tr> <tr style="vertical-align: top"> <td id="frmTitle"> <iframe id="left" style="z-index: 2; visibility: inherit; width: 195px; " name="left" src="left.aspx" frameborder="0" tabid="1"></iframe> </td> <td class="but" onclick="switchSysBar();"> <img id="switchPoint" style="border-right: 0px; border-top: 0px; border-left: 0px; width: 12px; border-bottom: 0px" alt="关闭左栏" src="images/butClose.gif" /> </td> <td> <div id="FrameTabs" style="overflow: hidden"> <div class="tab-right" onmouseover="this.className='tab-right tab-right-over'" onmouseout="this.className='tab-right tab-right-disabled'"> </div> <div class="tab-left" onmouseover="this.className='tab-left tab-left-over'" onmouseout="this.className='tab-left tab-left-disabled'"> </div> <div class="tab-strip-wrap" style="width:100%"> <ul class="tab-strip" style="float: left"> <li class="current" id="iFrameTab1"><a href="javascript:"><span id="frameTabTitle">我的工作台</span></a><a class="closeTab"><img src="/images/tab-close.gif" border="0"></a></A> </li> <li id="newFrameTab"><a title="新建标签页" href="javascript:"></a></li> </ul> </div> </div> <!-- 书签结束 width: 1880px; height: 800px" --> <div id="main_right_frame"> <iframe id="main_right" style="z-index: 2; visibility: inherit; overflow-x: hidden;" name="main_right" src="right.aspx" frameborder="0" scrolling="yes" onload="SetTabTitle(this)" tabid="1"></iframe> <div class="clearbox2"> </div> </div> </td> </tr> </tbody> </table> </form> </body> </html>
橙色阳光 2016-08-25
  • 打赏
  • 举报
回复
代码贴出来瞧瞧呗,或许是冲突了
拜一刀 2016-08-25
  • 打赏
  • 举报
回复
引用 5 楼 raychen_china 的回复:
<div id="main_right_frame"> <iframe id="main_right" style="z-index: 2; visibility: inherit; overflow-x: hidden;" name="main_right" src="right.aspx" frameborder="0" scrolling="yes" onload="SetTabTitle(this)" tabid="1"></iframe> </div> 父界面的iframe 子界面就是简单的div内容
"运行程式将子页面嵌套到父页面的iframe时候"这句运行的是什么
拜一刀 2016-08-25
  • 打赏
  • 举报
回复
引用 4 楼 raychen_china 的回复:
[quote=引用 2 楼 zeratul1990 的回复:] 你运行的什么代码
用vs2012,语言C#的asp.net写的啊 [/quote] 用vs2012,语言C#的asp.net写过iframe网站而且没出问题的人多了,你说的这么模糊上哪知道是哪的问题啊...
raychen_china 2016-08-25
  • 打赏
  • 举报
回复
<div id="main_right_frame">
<iframe id="main_right" style="z-index: 2; visibility: inherit; overflow-x: hidden;"
name="main_right" src="right.aspx" frameborder="0"
scrolling="yes" onload="SetTabTitle(this)" tabid="1"></iframe>
</div>
父界面的iframe
子界面就是简单的div内容
raychen_china 2016-08-25
  • 打赏
  • 举报
回复
引用 2 楼 zeratul1990 的回复:
你运行的什么代码
用vs2012,语言C#的asp.net写的啊
raychen_china 2016-08-25
  • 打赏
  • 举报
回复
引用 1 楼 shingoscar 的回复:
肯定是写的有问题
没有啊 我用easyui框架就没问题,但是用iframe就有问题,界面都能完整加载,但是加了jquery.js,子界面就相当于在浏览器新标签页打开一样,没有了iframe布置的框架
拜一刀 2016-08-25
  • 打赏
  • 举报
回复
你运行的什么代码
Poopaye 2016-08-25
  • 打赏
  • 举报
回复
肯定是写的有问题

111,129

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧