如何使用JavaScript从框架集框架中获取元素? [英] How can I get an element from within a frameset frame using JavaScript?

查看:143
本文介绍了如何使用JavaScript从框架集框架中获取元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从框架集框架中访问和元素。例如,如果我有以下标记:

I need to access and element from within a frameset frame. For example if I have the following markup:

<frameset rows="33%,33%,*">
  <frame src="frame1.html"/>
  <frame src="frame2.html"/>
  <frame src="frame3.html"/>
</frameset>

如何从其中一个子框架中获取某些元素?我试过这个:

How can I get some element from one of the child frames? I have tried this:

window.frames[1].getElementById('someElementId')

这导致类型错误:


getElementById()不是函数。

getElementById() is not a function.

有人可以协助吗?

谢谢!

推荐答案

您需要获取Document对象框架。

You need to get the Document object for the frame.

window.frames[1].document.getElementById('someElementId')

这篇关于如何使用JavaScript从框架集框架中获取元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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