Home > Web Front-end > JS Tutorial > JQueryiframe page operates elements and methods in the parent page (explanation with examples)_jquery

JQueryiframe page operates elements and methods in the parent page (explanation with examples)_jquery

WBOY
Release: 2016-05-16 17:14:19
Original
1182 people have browsed it

1) How to find the parent page element in an iframe:
$('#id', window.parent.document)

2) Call the methods and variables defined in the parent page in the iframe:
parent.method
parent.value

3) Example

1. Parent page

Copy code The code is as follows:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="IframeDemo._Default" %>









default.aspx


                                                                                >




Copy code

The code is as follows:
<%@ Page Language="C#" AutoEventWireup ="true" CodeBehind="IFrame.aspx.cs" Inherits="IframeDemo.IFrame" %>                                                                                                                                                                                                                                                                 Element
          alert($('#default', window.parent.document).html()); 🎜>                                                                                                                                                                               ;body>


  IFrame.aspx






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