I want to call a parent window JavaScript function from an iframe.

<script>function abc(){
alert("sss");}</script><iframeid="myFrame"><aonclick="abc();"href="#">Call Me</a></iframe>

Answers

 
<aonclick="parent.abc();"href="#">Call Me </a>

See window.parent

Returns a reference to the parent of the current window or subframe.

If a window does not have a parent, its parent property is a reference to itself.

When a window is loaded in an <iframe><object>, or <frame>, its parent is the window with the element embedding the window.

I want to call a parent window JavaScript function from an iframe.

<script>function abc(){
alert("sss");}</script><iframeid="myFrame"><aonclick="abc();"href="#">Call Me</a></iframe>
asked Jan 29 '10 at 10:53
Arjun Singh

868276
 
    
I won't able to show anything right now (2016), I don't know if the older bower would support any – DotKu Mar 21 at 19:04

8 Answers

up vote274down voteaccepted
<aonclick="parent.abc();"href="#">Call Me </a>

See window.parent

Returns a reference to the parent of the current window or subframe.

If a window does not have a parent, its parent property is a reference to itself.

When a window is loaded in an <iframe><object>, or <frame>, its parent is the window with the element embedding the window.

Calling a parent window function from an iframe的更多相关文章

  1. ☀【window.self / window.parent / window.top】

    Js中的window.parent ,window.top,window.self 详解 √http://blog.csdn.net/zdwzzu2006/article/details/604763 ...

  2. window.parent ,window.top,window.self 详解及parent和opener的区别

    window.parent ,window.top,window.self 详解 在应用有frameset或者iframe的页面时,parent是父窗口,top是最顶级父窗口(有的窗口中套了好几层fr ...

  3. window.parent != window 解决界面嵌套问题

    页面在被嵌套的时,效果:,,如果用户点击“刷新”,该问题即可解决. 如果想通过代码解决的话,这个问题属于客户端的问题,不是服务器端的问题. 如果直接写:window.location.href = “ ...

  4. 16. 窗口函数 (Window Function) 的使用

    从SQL Server 2005起,SQL Server开始支持窗口函数 (Window Function),以及到SQL Server 2012,窗口函数功能增强,目前为止支持以下几种窗口函数: 1 ...

  5. SQL Server Window Function 窗体函数读书笔记一 - SQL Windowing

    SQL Server 窗体函数主要用来处理由 OVER 子句定义的行集, 主要用来分析和处理 Running totals Moving averages Gaps and islands 先看一个简 ...

  6. JS中iframe相关的window.self,window.parent,window.top

    window.self指的是当前窗口:他等价于window,self,window.self window.top指的是最顶层的窗口(有些页面可能会嵌套好几个iframe)如果只有一个窗口,那么就返回 ...

  7. 【转】Js中的window.parent ,window.top,window.self 详解

    [转自]http://blog.csdn.net/zdwzzu2006/article/details/6047632 在应用有frameset或者iframe的页面时,parent是父窗口,top是 ...

  8. 关于 window.parent, window.top, window.self 详解

    在应用有frameset或者iframe的页面时,parent是父窗口,top是最顶级父窗口(有的窗口中套了好几层frameset或者iframe),self是当前窗口,opener是用open方法打 ...

  9. Javascript 中的window.parent ,window.top,window.self 详解

    在应用有frameset或者iframe的页面时,parent是父窗口,top是最顶级父窗口(有的窗口中套了好几层frameset或者iframe),self是当前窗口, opener是用open方法 ...

随机推荐

  1. Ubuntu16.04安装MySql5.7

    安装方式有好多种,这里选择使用APT安装. 主要参考文档为官方文档:https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/#apt-repo- ...

  2. Java学习关于集合框架的基础接口--Collection接口

     集合框架(Collection  Framework)是Java最强大的子系统之一,位于java.util 包中.集合框架是一个复杂的接口与和类层次,提供了管理对象组的最新技术.Java集合框架标准 ...

  3. Coreldraw绘制标准波浪线

    Coreldraw中如何绘制标准波浪线? 先画一根直线,单击工具栏中的“互动式工具组”,选择“互动式变形工具”, 再在弹出的属性栏中选择“拉链变形”,在幅度和频率中分别输入波形的波峰 到波底的值.波浪 ...

  4. jsp页面遍历输出

    <c:foreach>类似于for和foreach循环 以下是我目前见过的用法: 1.循环遍历,输出所有的元素.<c:foreach items="${list}" ...

  5. Python 迭代器&生成器,装饰器,递归,算法基础:二分查找、二维数组转换,正则表达式,作业:计算器开发

    本节大纲 迭代器&生成器 装饰器  基本装饰器 多参数装饰器 递归 算法基础:二分查找.二维数组转换 正则表达式 常用模块学习 作业:计算器开发 实现加减乘除及拓号优先级解析 用户输入 1 - ...

  6. Spring Boot Reactive Streams

    1 响应式编程规范 目标:provide a standard for asynchronous stream processing with non-blocking backpressure ht ...

  7. AI Gossip

    本文作者:七牛云人工智能实验室-林亦宁原文地址:https://zhuanlan.zhihu.com/p/26168331 什么是智能 回到几万年前的东非大草原,谁能意识到,那个到处被欺负的,被表哥从 ...

  8. [NOIP2002] 提高组 洛谷P1031 均分纸牌

    题目描述 有 N 堆纸牌,编号分别为 1,2,…, N.每堆上有若干张,但纸牌总数必为 N 的倍数.可以在任一堆上取若于张纸牌,然后移动. 移牌规则为:在编号为 1 堆上取的纸牌,只能移到编号为 2 ...

  9. Linux中命令选项及参数简介

    登录Linux后,我们就可以在#或$符后面去输入命令,有的时候命令后面还会跟着“选项”(英文options)或“参数”(英文arguments).即Linux中命令格式为: command [opti ...

  10. HDU——2444 The Accomodation of Students

    The Accomodation of Students Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K ( ...