src: file The path can be an HTML file, text, ASP, etc.; width, height: the width and height of the "picture-in-picture" area; scrolling: when the specified HTML file of SRC is in the specified area When the scrolling option is not displayed or completed, if it is set to NO, the scroll bar will not appear; if it is Auto: the scroll bar will automatically appear; if it is Yes, it will be displayed; FrameBorder: the width of the area border, in order to make " Picture-in-picture "Blends with adjacent content, usually set to 0." For example:
Copy code
The code is as follows:
2. The mutual control between the parent form and the floating frame. In the scripting language and object hierarchy, the window containing the Iframe is called the parent form, while the floating frame is called the child form. Clarify these two This relationship is important because to access a child form in a parent form or vice versa, you must know the object hierarchy before you can access and control the form programmatically. 1. Access and control objects in the subform in the parent form In the parent form, the Iframe, that is, the subform, is a child object of the document object, and you can directly access the subform in the script. objects in . Now there is a question, that is, how do we control this Iframe? Here we need to talk about the Iframe object. When we set the ID attribute to this tag, we can perform a series of controls on the HTML contained in the Iframe through the Document Object Model DOM. For example, embed the test.htm file in example.htm and control some tag objects in test.htm:
Copy code
The code is as follows:
test.htm file code is:
hello,my boy< /h1>
If we want to change the text in the H1 tag with the ID number myH1 to hello, my dear, it can be used : document.myH1.innerText="hello,my dear" (document can be omitted) In the example.htm file, the subform pointed to by the Iframe tag object is consistent with the general DHTML object model. The object access control method is the same and will not be described again. 2. Access and control objects in the parent form in the subform In the subform, we can access the objects in the parent window through its parent (parent) object. Such as example.htm: