Jump to content

[Solved]the difference between "document.getElementsByTagName('iframe')" and "document.parentwindow.frames"?


Recommended Posts

$tFrame = $oIexp.document.getElementsByTagName('iframe').item(0)

$oFrame = $oIexp.document.parentwindow.frames.item(0)

As shown above,

$tFrame and $oFrame,

what is the difference between the two Frames objects obtained by the two methods?

Because problems are found during use:

1 、$tFrame.attributes() can work

1 、$oFrame.attributes() can not work

So some doubts, hope to understand more clearly.

Thanks in advance!

Edited by Letraindusoir
Link to comment
Share on other sites

Hello,

 $oIexp.document.getElementsByTagName('iframe').item(0)  returns HTMLFrameElement object
 $oIexp.document.parentwindow.frames.item(0) returns HTMLWindow2 object

 

Saludos

 

Link to comment
Share on other sites

Hello,

 $oIexp.document.getElementsByTagName('iframe').item(0)  returns HTMLFrameElement object
 $oIexp.document.parentwindow.frames.item(0) returns HTMLWindow2 object

 

Saludos

 

Link to comment
Share on other sites

It are just different objects with different methods

https://www.w3schools.com/jsref/met_document_getelementsbytagname.asp

The getElementsByTagName() method returns a collection of all elements in the document with the specified tag name, as an HTMLCollection object

 

Link to comment
Share on other sites

Link to comment
Share on other sites


Thank all masters  for the help!

I seem to understand what's going on.....

$tForm =$oIexp.document.getElementsByTagName('form').item(0)

$oForm = $oIexp.document.forms.item(0)

The above seems to be equivalent object. No errors were found in use.

but

$tFrame = $oIexp.document.getElementsByTagName('iframe').item(0)

$oFrame = $oIexp.document.parentwindow.frames.item(0)

those are different types of objects, so there are errors

Edited by Letraindusoir
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...