An IFRAME is a framed form of embedded web pages that can be refreshed partially by changing the embedded part.
The use of IFRAME is similar to the normal tag element Div, which specifies the position, color, interface layout, etc. embedded in the page.
One, IFrame realizes the local refreshing method one
<script type= "Text/javascript" >
$ (function () {
$ ("#a1"). Click (function () {
var name= $ (this). attr ("name");
$ ("#iframe"). attr ("src", name). Ready ();
})
$ ("#a2"). Click (function () {
var name= $ (this). attr ("name");
$ ("#iframe"). attr ("src", name). Ready ();
})
</script>
<a href= "#" id= "A1" Name= "a1.html" >1</a>
<a href= "#" id= "A2" Name= "A2.html" >2</a>
When the point A1 in the IFRAME Display a1.html content, point A2 in the IFRAME display a2.html content
Two, the method of realizing local refreshing of IFrame two
<a href= "a1.html" id= "A1" Name= "a1.html" target= "i" >1</a> <a href= "a2.html" id= "A2" Name= "A2.html"
target= "I" >2</a>
Note: <form> also has the target attribute, which functions as <a> the same way if <from> or <a> Commit to an action and then jump to the a1.html effect, if there is req.set or session.set in the action, the last in the IFrame can also be displayed.
Three: The method of implementing local refresh by IFRAME three:
<iframe src= "1.htm" name= "Ifrmname"
id= "Ifrmid" ></iframe>
Scenario One: Use the name attribute of the IFRAME to locate
<input type= "button" name= button "value=" button "onclick=" Document.frames (' Ifrmname '). Location.reload () ">
Or
<input type= "button" name= "button" value= "button" onclick= "Document.all.ifrmname.document.location.reload" () " >
Scenario Two: Using the id attribute of the IFRAME to locate
<input type= "button" name= "button" value= "button" onclick= "Ifrmid.window.location.reload ()" >
Solution III: When the SRC is the other web site address (cross-domain operation)
<input type= "button" name= "button" value= "button" onclick= "window.open (document.all.ifrmname.src, ' ifrmname ', '") ">
Scenario Four: Partial refresh through and replace the SRC of the IFRAME
You can use document.getElementById ("Iframname"). src= "" to redirect the IFrame;
The sample code is as follows: test.html
The above content to introduce a JavaScript in the IFRAME to achieve local refresh of several methods summarized, I hope that we choose according to their own needs, have any questions welcome to my message, thank you!