Through

Source: Internet
Author: User
Tags closing tag

1. What is an IFRAME?

The IFRAME closing tag creates an inline frame that contains another document, which can be placed between the IFRAME for browsers that do not support IFRAME.

The role of 2.iframe

(1) Download of file (attachment) via IFRAME

  <a href= "#" onclick= "Download ()" >download</a>
  <iframe id= "ifile" style= "Display:none" ></ iframe>

  function Download () {
    var Dom=document.getelementbyid (' IFile ');
    Dom.src= "http:xxxx.com";
 }

By hiding the IFRAME, when the Click event is triggered, the dynamic setting SRC will be able to implement the file download function.

(2) Uploading images or submitting forms via IFRAME.

<iframe id= "Upload_target" name= "Upload_target" src= "upload.php" style= "Width:0;heigth:0;overflow:hidden;border : 0;position:absolute; left:-500px; " ></iframe>


<form enctype= "Multipart/form-data" action= "upload.php" method= "post" target= "Upload_ Target ">  
     <input type=" file "Name=" UserFile "class=" file "value="/> <input  
     type= "Submit" Name= " Uploadimg "value=" Upload "onclick=" upload () "/>  

In this way, the Click event Triggers upload () and the post is submitted, and the page is not refreshed at the same time.

What are the disadvantages of 3.iframe?

(1) IFRAME blocks the OnLoad event on the home page

(2) Search page can not interpret this page (not conducive to SEO)

(3) The IFRAME and the main page share the connection pool, and the browser has restrictions on the same area, which can affect performance.

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.