Simple Application of IFRAME and form target

Source: Internet
Author: User
Tags custom name

Most websites have a fixed structure and perform partial refresh. We can use ajax to refresh the HTML code in the placeholder Div or span. However, HTML snippets are much more difficult to write than the entire HTML page. Therefore, many websites use IFRAME to divide the entire page into several relatively independent parts, each of which corresponds to a complete HTML page.

The following is an example of the common combination of IFRAME and form, which is suitable for applications in the MVC Architecture. The example is very simple:

Home page: iframe.html

<HTML>
<Head>
<Title> HA </title>
</Head>
<Body>
<Form name = "form1">
<Div>
<IFRAME name = "query" src = "test.html"> </iframe>
<IFRAME name = "list"> </iframe>
</Div>
<Div>
<IFRAME name = "theid"> </iframe>
<IFRAME name = "thename"> </iframe>
</Div>
</Form>
</Body>

<Form name = "jumpform" target = "theid" Action = "test.html">
<Input type = "Submit" value = "Submit">
</Form>

</Html>

Subpage: test.html

<HTML>
<Head>
<Title> Hello </title>
</Head>
<Body>
Ben hello!
</Body>
</Html>

We can see that the home page is divided into four independent blocks. In the IFRAME tag, the property SRC is used to specify the HTML subpage to be displayed. Here, JavaScript can be used for dynamic display.

In jumpform, the target value is defined as IFRAME-theid. At this time, when the form is submitted, the returned page will be displayed in the IFRAME of theid.

Target attribute:
_ Blank ---------- new window
_ Self ----------- self
_ Top ------------ main framework
_ Parent --------- parent framework
The custom name ----- appears in the framework structure, and the link is opened in the framework of the name.

The target attribute specifies how to open the linked page in a browser window. Its parameter values include _ blank, _ parent, _ self, and _ top, the meanings of these parameter values are as follows:

◎ _ Blank: Open the linked file in the new browser window.

◎ _ Parent: load the linked file into the parent frame set or parent window containing the linked framework. If the frame containing the link is not nested, load the link file in the full screen window of the browser, just like the _ Self parameter.

◎ _ Self: Open the linked document in the same framework or window. This parameter is the default value and is not required.
But I don't quite understand
◎ _ Top: Open the linked document in the current entire browser window and delete all frameworks

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.