javascript:访问不同框架中的对象? [英] javascript: get access to objects in different frame?

查看:77
本文介绍了javascript:访问不同框架中的对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在1页上有2帧的框架集,JS是否有办法从相反的框架访问元素?

if I have 2 frames of a frameset on 1 page, is there a way for JS to access elements from the opposite frame?

谢谢!

推荐答案

是的,但前提是两个帧上的页面都在同一个域上。您可以执行 document.getElementById(frame_id)。contentWindow.document ...但是如果页面位于不同的域中,您将获得异常。

PS。您可以阅读更多此处

Yes, but only if pages on both frames is on the same domain. You can do document.getElementById( "frame_id").contentWindow.document... But still if pages are on different domain you will get an exception.
PS. You can read more here

这篇关于javascript:访问不同框架中的对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆