Let people confused iframe

xiaoxiao2021-03-06  41

Today, I used IFRAME when I was doing a web page, and I have encountered a blame. If the code is Document..ll.iframe1..Document.getlementsByTagName ("DIV"), the return is that all DIV elements in the iFrame itself, if the code is document.frames ("iframe1"). Document.getElementsBytagname (" "), Returning all DIV elements in the page contained in IFRAME, in accordance with usual thinking, I feel that there is no difference between the two, don't understand. Then look at the HTML development manual, find the following explanation: 1. The object model of the page where the IFRAME object is located, you can access the properties of the iframe object, but you cannot access its content. For example, the syntax of the Border style accessed the IFrame object should be:

SborderValue = Document.all.Oframe.style.Border;

note

Iframe's properties must be prefixed

Document.all Access, for example

Document.all.iframeid.marginwidth.

2. The following example returns a reference to the ALL collection of the document included in IFRAME.

Var collall = document.frames ("iframe1"). Document.all

It can be seen that the writing 1 and Writing 2 can be visited, so it is inconsistent, so the usual thinking method may be deceived.

we. In fact, this may just be the fault I will make, but it is really depressed, so write it down, maybe, I will watch it later.

After that, don't touch it.

转载请注明原文地址:https://www.9cbs.com/read-78304.html

New Post(0)