简体   繁体   English

从内部获取对象 <object> 在javascript中标记

[英]Getting a object from inside an <object> tag in javascript

I have an HTML code with the following: 我有以下HTML代码:

<object class="sis" id="sis1" type="text/html" data="sis/sis1.html"></object>

and in the imported file I have and <h2> I am trying to manipulate with JS, but I can figure out a way to select the element. 在导入的文件中,我有<h2>我正在尝试使用JS进行操作,但是我可以找出一种选择元素的方法。

I've even tried: document.getElementById("sis1").getElementById("h2_id") but -> Uncaught TypeError: Object #<HTMLObjectElement> has no method 'getElementById' 我什至尝试过: document.getElementById("sis1").getElementById("h2_id")但-> document.getElementById("sis1").getElementById("h2_id") Uncaught TypeError: Object #<HTMLObjectElement> has no method 'getElementById'

你试过了吗?

document.getElementById('sis1').contentDocument.getElementById('h2_id');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM