HTML iframe usage summary collection_HTML/Xhtml_Web page production
WBOY
Release: 2016-05-16 16:43:10
Original
1498 people have browsed it
Iframe usage analysis
BORDER
Set the edge width around the frame FRAMEBODER
Copy the code
The code is as follows:
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:
Copy code
The code is as follows:
< ;html>
hello,my wife
If we want to access the title text in frame1.htm with ID number myH2 and change it to "hello, my friend", we can write like this: parent.myH2.innerText="hello,my friend" The parent object here represents the current form (the form where example.htm is located). You need to access the objects in the parent form in the child form, without exception. All done through the parent object. Although Iframe is embedded in another HTML file, it remains relatively independent and is an "independent kingdom". The characteristics in a single HTML also apply to floating frames. Just imagine, through the Iframe tag, we can express the unchanged content as an Iframe. In this way, we don’t have to write the same content repeatedly. This is a bit like a process or function in programming, saving a lot of tedious manual work. labor! In addition, and crucially, it makes page modifications more feasible, because instead of having to modify each page to adjust the layout, you only need to modify the layout of one parent form. One thing to note is that the Nestscape browser does not support the Iframe tag, but in today's world of IE, this does not seem to be a big deal. Iframe tags are widely used, not only for their own sake (the website), but also for netizens to save money. Internet fees, why not? Example
2 :::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: After using iframe, I found that the scroll bar is not beautiful and I want to use 2 pictures to replace it. ↑↓ How should it be implemented? Answer: Replace the web page's
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn