Jquery has a load () method. You can use $ ("# Div"). Load ("/index.html") to load index.html to a div-ID container,
IFRAME can also be used, but it is not perfect. For more information, see the discuz websites. If you log on to a layer, it is also a load page, but I found that about: blank is being opened on the left of the status bar. I don't know if I want to set the SRC of IFRAME to about: blank, and then edit IFRAME? However, check Source code When the page is not loaded, the page source cannot be seen. Code I don't know if I used the head analysis just like jquery. Then I added the header information of the loaded page to the header of the Home Page. Then I used the eval () function to execute JavaScript code and solve it?
I used a page as the container carrying the page source code, named do.html, and passed a page to be loaded by uri?do.html!
Example Demo: http://mi.8866.org: 2/management. aspx/direct point login can be
This page loads two JS files
Copy code The Code is as follows: <SCRIPT type = "text/JavaScript" src = "/image/script. ashx/global. js? Ver = 1.0.0 "> </SCRIPT>
<SCRIPT type = "text/JavaScript" src = "/image/script. ashx/plus. js? Ver = 1.0.0 "> </SCRIPT>
The source code of do.html is:Copy codeThe Code is as follows: <HTML>
<Head>
<Title> loading... </title>
<SCRIPT type = "text/JavaScript" src = "/image/script. ashx/do. js? Ver = 1.0 "> </SCRIPT>
</Head>
<Body>
</Body>
</Html>
File: Do. jsCopy codeThe Code is as follows: Document. Write ("<SCRIPT src = \"/image/script. ashx/global. js? Ver = 1.0.0 \ "> </SCRIPT> ");
Document. Write ("<SCRIPT src = \"/image/script. ashx/plus. js? Ver = 1.0.0 \ "> </SCRIPT> ");
Window. onload = function (){
J. Plus. loadpage ({URI: "/", time: 1 },{
Start: function () {/* the receipt function that starts loading */},
Over: function () {/* loaded receipt function */}});
}
loadpage is defined as follows: copy Code the code is as follows: if (! Typeof (window. j) window. j = new JS ();
J. plus = new Plus ();
Function Plus () {}< br> plus. prototype. loadpage = function (R, callback, E, times) {
/*
r request; R. time: Waiting for loading (millisecond);
callback: receipt function (callback. start (), callback. over ()
E. element page container; */
If (! R. Uri) Alert ('page URI parameters not be found! ');
var AJ = new Ajax ();
AJ. request (R, {
Start: function () {If (callback. start) callback. start (); If (e) E. innerhtml = 'loading .. '; else {document. body. innerhtml = 'loading ';}},
error: function (x) {If (e) E. innerhtml = 'loading failed! '; Else document. body. innerhtml = 'loading failed' ;},
success: function (x) {
var func = function () {If (callback. over) callback. over (); If (e) E. innerhtml = x; else document. write (x) ;};
If (R. time) {var T = new timer (R. time, func); T. start () ;}/ * latency display */
else func ();
}});
}< br>/* AJ is the Ajax request object in global. JS defines
* timer code to implement a timer, in plus. defined in js */
The function has been defined. Add the Code where the function needs to be loaded:
File:/management. aspx/Copy codeThe Code is as follows: var BD = J. $ ("mainbody"); // mainbody is a div container
VaR uri = "/do.html? Uri =/management. aspx/"+ URI;
BD. innerhtml = "<IFRAME src = '" + URI + "'frameborder = '0' width ='" + (J. X ()-200) + "'height = '000000' scrolling = 'no'> </iframe> ";
Because do.html will be slowed down, in do.js, ajaxwill be used to export the returned HTML to do.html.
Online Demo address http://demo.jb51.net/js/menu_iframe/index.htm