Accessing Document inside Object using plain Javascript -


I have a sample HTML structure, where two DOMs are available at the same HTML below. I use javascript in HTML to & lt; Object & gt; Embedded inside the tag, & lt; H1 & gt; Trying to access the tag I tried to use the following javascript and could not get the text value of H1. Please note, I just do not want to use javascript via javascript.

  & lt ;! DOCTYPE html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Meta charset = "UTF-8" & gt; & Lt; Title & gt; Test JS & lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Div class = "parent" & gt; & Lt; H1 class = "header_Child" & gt; I'm within the original HTML & lt; / H1> & Lt; Div class = "objectWrapper" & gt; & Lt; Object type = "text / html" & gt; #document & lt ;! DOCTYPE html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Title & gt; I have an embedded HTML & lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; H1 class = "header_Child" & gt; I have HTML inside the & lt; / H1> & Lt; / Body & gt; & Lt; Html & gt; & Lt; / Object & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Body & gt;  

Javascript:

  var obj = document.getElementsByTagName ('object'); Var header = oz. [1]. Some selectors all ('H1'). InnerHTML;  

document. GetElementsByTagName () no array document So that you can not call querySelectorAll on it that you need to get the first element of the array and handle it.


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -