Click here to Skip to main content
15,901,205 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
the problem is the iframe not accessible for example:if you have a button inside a frame it will be not active
ASP.NET
<%@ 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>
Posted
Comments
Karthik Harve 22-Apr-13 5:28am    
if the button inside iframe (inside the screen associated with IFrame), then we have to check that screen which is associated with iframe. verify in that screen.
amr mustafa 22-Apr-13 5:39am    
I don't know how to do it..plz help me

1 solution

Assume your iFrame's id is "targetFrame" and the function you want to call is targetFunction():
JavaScript
document.getElementById('targetFrame').contentWindow.targetFunction();


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
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900