如何从对象标签获取html元素? [英] How to get html elements from an object tag?

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

问题描述



我的代码看起来像这样:



< html>< object data =/ html_template>< / object>< / html>



正如在页面加载后预期的那样,在对象标签之间添加了一些元素。
我想获得这些元素,但我似乎无法访问它们。



我试过以下
$(object).html() $(object)。children() $(对象)[0] .innerHTML



这些都不起作用。是否有另一种方式来获得这些元素?



编辑:

更详细的示例:



考虑到这个

< html>< object data =http:// www。 YouTube.com/v/GGT8ZCTBoBA?fs=1&hl=zh_CN></object></html>



如果我尝试在对象中获取html,我会得到一个空字符串。



http://jsfiddle.net/wwrbJ/1/

解决方案 innerHTML 将提供对位于< object> < / object>之间的html的访问; 。所要求的是如何获得它正在生成的窗口/框架内的对象加载的HTML(它与开放和关闭标签之间的代码无关)。

我也在寻找答案,恐怕没有答案。如果我找到一个,我会回来并在这里发布,但我现在正在寻找(而不是单独)很多时间。


I'm using the object tag to load an html snippet within an html page.

My code looks something along these lines:

<html><object data="/html_template"></object></html>

As expected after the page is loaded some elements are added between the object tags. I want to get those elements but I can't seem to access them.

I've tried the following $("object").html() $("object").children() $("object")[0].innerHTML

None of these seem to work. Is there another way to get those elements?

EDIT:

A more detailed example:

consider this

<html><object data="http://www.YouTube.com/v/GGT8ZCTBoBA?fs=1&hl=en_US"></object></html>

If I try to get the html within the object I get an empty string.

http://jsfiddle.net/wwrbJ/1/

解决方案

The innerHTML will provid access to the html which is in between the <object> and </object>. What is asked is how to get the html loaded by the object inside the window/frame that it is producing (it has nothing to do with the code between the open and close tags).

I'm also looking for an answer to this and I'm afraid there is none. If I find one, I'll come back and post it here but I'm looking (and not alone) for a lot of time now.

这篇关于如何从对象标签获取html元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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