In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces "the difference between iframe and frame in html". In daily operation, I believe that many people have doubts about the difference between iframe and frame in html. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts about "the difference between iframe and frame in html". Next, please follow the editor to study!
The difference between iframe and frame
The use of the iframe tag to mention iframe, you may have already thrown it into the "forgotten corner", but it is no stranger to talk about his brother frame. Frame tags are frame tags, and what we call a multi-frame structure is to display multiple HTML files in a browser window. Now, we encounter a very realistic situation: if there is a tutorial, there is a link between "the previous section" and "the next section" at the end of each page, except that the content of each tutorial section is different. the rest of the page is the same. if you do a stupid page page by page, it seems too boring, and it suddenly occurred to me that if there was a way to keep the rest of the page the same. Only make the tutorial into an one-page content page with no other content. when you click the up-and-down page link, only change the content part of the tutorial, and the rest remains the same. in this way, one is time-saving, and if there is a change in the tutorial in the future, it is also very convenient, so that it will not affect the whole army at one stroke. What is more important is to download those ads Banner, column lists, navigation and other things on almost every page only once and then stop downloading them.
Iframe tag, also known as floating frame tag, you can use it to embed an HTML document in a HTML display. It is different from the biggest feature of the frame tag, that is, the HTML file referenced by this tag is not displayed independently with another HTML file, but can be directly embedded in a HTML file, and the contents of this HTML file are integrated into a whole. In addition, the same content can be displayed in a page many times without having to repeat the content, an image metaphor that is "picture-in-picture" TV.
Now let's talk about the use of iframe tags.
The format in which iframe tags are used is:
one
Src: the path to the file, which can be either HTML file, text, php, etc.
Width, height: width and height of "picture-in-picture" area
Scrolling: scroll option when the specified HTML file of SRC cannot be displayed in the specified area. If set to NO, no scroll bar appears; if Auto:, scroll bar appears automatically; if Yes, scroll bar appears automatically
FrameBorder: the width of the border of the area, which is often set to 0 in order to blend the picture-in-picture with the adjacent content.
For example:
1 the mutual control between the parent form and the floating frame in the scripting language and object level, the window that contains iframe is called the parent form, while the floating frame is called the sub-form, it is important to understand the relationship between the two, because to access the sub-form in the parent form or vice versa, you must be clear about the object hierarchy in order to access and control the form through the program.
Access and control objects in the child form in the parent form
In the parent form, the iframe, that is, the sub-form is a child of the document object, and you can access the objects in the sub-form directly in the script.
Now there is a question, that is, how do we control the iframe? here we need to talk about the iframe object. When we set the ID attribute to this tag, we can have a series of controls over the HTML contained in iframe through the document object model DOM.
For example, embed a test.htm file in example.htm and control some tag objects in test.htm:
The 1test.htm file code is:
123hello
NowaMagic45 if we want to change the text in the H1 tag with ID number myH1 to hello, NowaMagic, we can use:
1document.myH1.innerText= "hello,my"
Dear "; in the example.htm file, the sub-form referred to by the iframe markup object is consistent with the general DHTML object model, and the access to the object is controlled in the same way.
Access and control objects in the parent form in the child form
In the child form, we can access the object in the parent window through its parent, the parent (parent) object.
For example, example.htm:
1234hello,my
Wife56 if you want to access the title text in the ID number myH2 in frame1.htm and change it to "hello,my friend", we can write:
1parent.myH2.innerText= "hello,my"
Friend "; here the parent object represents the current form (the form where the example.htm is located), and the objects in the parent form are accessed in the child form, without exception, through the parent object.
Although iframe is embedded in another HTML file, it remains relatively independent and is an "independent kingdom". The features in a single HTML also apply to floating frames.
Just imagine, through the iframe tag, we can express the same content as iframe, so that we don't have to repeat the same content, which is a bit like a process or function in programming, saving how much tedious manual labor! In addition, crucially, it makes page changes more feasible, because you don't have to modify each page because of the layout adjustment, you only need to change the layout of one parent form.
It should be noted that Nestscape browsers do not support iframe tags, but in the current IE world, this seems to be no big deal. Iframe tags are widely used, which not only thinks for themselves (the website), but also saves Internet fees for netizens, why not?
Floating frame is a definition in the HTML4.0 specification and is supported by current browsers.
Unlike the partitions represented by frameSET, a floating frame exists on a Web page as a built-in object in the style of a graph or an applet on a page. Floating frame uses tags, which have most of the same property settings, including: name, src, marginwidth, marginheight, frameborder, and scrolling. At the same time, it has the same height, width, and align properties as graphics or applet.
Moreover, a floating frame follows the same target principle as a normal frame: we can point to it through its name. This principle applies to floating frame in any type of frame, and vice versa. The link without traget in the floating frame points to itself, while the _ parent link points to the frame or window where the included document is located. For example:
1245Show
One.htm6Show
Two.htm7Bring
Back start.htm note that any content between and will be ignored for browsers that support tags. On the contrary, the contents will be displayed, which can be used to explain that the current browser does not support it.
At this point, the study of "the difference between iframe and frame in html" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.