iframe无法访问 [英] iframe not accessible
本文介绍了iframe无法访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问题是iframe无法访问,例如:如果框架内有按钮,它将无法激活
the problem is the iframe not accessible for example:if you have a button inside a frame it will be not active
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="student_information.aspx.cs" Inherits="Student_inpector.student.student_information" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style>
iframe {
width: 100%;
border: none;
height: 300px;
}
#header {
width: 100%;
height: 100px;
-webkit-box-shadow: 1px 1px 3px 2px #262626;
box-shadow: 1px 1px 3px 2px #262626;
border-radius: 4px;
background: rgba(62, 62, 62, 0.59);
}
body {
background: url(../images/the_book_by_consigntooblivion-d3dc7b9.jpg);
-moz-background-size: cover;
-o-background-size: cover;
-webkit-background-size: cover;
background-size: cover;
}
.lbl {
-webkit-text-shadow: 1px 1px 3px #191919;
text-shadow: 1px 1px 3px #191919;
font-size: x-large;
width: 100%;
height: 100%;
position: absolute;
top: 5%;
left: 1%;
}
.lnkbtn {
text-decoration: none;
font-size: x-large;
color: #3e3e3e;
position: absolute;
right: 2%;
top: 10%;
}
.lnkbtn:hover {
color: #4b4b4b;
-webkit-text-shadow: 1px 1px 3px #191919;
text-shadow: 1px 1px 3px #191919;
}
</style>
<link rel="stylesheet" href="../jquery-ui-themes-1.10.2/themes/humanity/jquery-ui.min.css" />
</head>
<body>
<form id="form1" runat="server">
<div id="header">
<asp:Label ID="Label1" CssClass="lbl" runat="server" Text=""></asp:Label>
<asp:LinkButton ID="LinkButton1" CssClass="lnkbtn" runat="server" OnClick="LinkButton1_Click">Logout</asp:LinkButton>
</div>
<br />
<div id="accordion">
<p>Parent information</p>
<div>
<iframe id="ifrm1" runat="server" src="s_parentinformation.aspx"></iframe>
</div>
<p>Student information</p>
<div>
<iframe id="ifrm2" src="s_studentinformation.aspx"></iframe>
</div>
<p>Marks</p>
<div>
<iframe id="ifrm3" src="s_mark.aspx"></iframe>
</div>
<p>Notes</p>
<div>
<iframe id="ifrm4" src="s_notes.aspx"></iframe>
</div>
<p>Attendance</p>
<div>
<iframe id="ifrm5" src="s_attendance.aspx"></iframe>
</div>
<p>Fees</p>
<div>
<iframe id="ifrm6" src="s_fees.aspx"></iframe>
</div>
</div>
</form>
<script src="../jquery-ui-1.10.2.custom/js/jquery-1.9.1.js"></script>
<script src="../jquery-ui-1.10.2.custom/js/jquery-ui-1.10.2.custom.min.js"></script>
<script>
$("#accordion").accordion({
collapsible: true,
active: false,
});
</script>
</body>
</html>
推荐答案
( #accordion)。accordion({
collapsible: true ,
有效: false ,
});
< / script >
< / body >
< / html >
("#accordion").accordion({ collapsible: true, active: false, }); </script> </body> </html>
假设您的iFrame的ID是targetFrame
并且你要调用的函数是targetFunction():
Assume your iFrame''s id is "targetFrame
" and the function you want to call istargetFunction():
document.getElementById('targetFrame').contentWindow.targetFunction();
注意: 您还可以使用 window.frames $访问该框架c $ c>而不是
document.getElementById
。
但是 - 如果创建了IFRAME,则不能使用window.frames ammatically,只有它在HTML页面源中声明
干杯,
Edo
NOTE: You can also access the frame using window.frames
instead of document.getElementById
.
BUT - You can''t use "window.frames" if your IFRAME was created programmatically, only if it is declared in the HTML page source
Cheers,
Edo
这篇关于iframe无法访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文