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.