If you don't talk much about it, You can store your own code by pasting code.
Copy codeThe Code is as follows:
Var temp_iframe
Var content = document. getElementById ('right'); // create an iframe and adaptive width/height in the right DOM container.
Var c = 0;
Function append (filename)
{
Var the_iframe = "helpfile" + c;
Temp_iframe = document. createElement ("iframe ");
Temp_iframe.src = filename;
Temp_iframe.scrolling = "no ";
Temp_iframe.setAttribute ("frameborder", "0 ");
Temp_iframe.id = the_iframe;
Temp_iframe.name = the_iframe;
Scroll (0, 0 );
Content. innerHTML = "";
Content. appendChild (temp_iframe );
If (document. all)
{
Temp_iframe.attachEvent ('onload', function ()
{
Temp_iframe.setAttribute ("width", please specify frames=the_iframe=.doc ument. body. scrollWidth); // adaptive width
Temp_iframe.setAttribute ("height", please specify frames=the_iframe=.doc ument. body. scrollHeight); // adaptive height
});
}
Else
{
Temp_iframe.addEventListener ('load', function ()
{
Temp_iframe.setAttribute ("width", please specify frames=the_iframe=.doc ument. body. scrollWidth );
Temp_iframe.setAttribute ("height", please specify frames=the_iframe=.doc ument. body. scrollHeight );
}, False );
}
C ++;
Return false;
}
/* Call Method
Save the script as a script file: iframe. js, and then call it on the front-end page:
------------------------------------------------------------------------
<A href = "index.html" onclick = "return append('xxxx.html ')" class = "li1">
<Div id = "right"> </div>
<Script type = "text/javascript" src = "iframe. js"> </script>
------------------------------------------------------------------------
Or remove the final return false in the script. Foreground:
------------------------------------------------------------------------
<A href = "javascript: append ('favorite/Favorites.html ')" class = "li1">
<Div id = "right"> </div>
<Script type = "text/javascript" src = "iframe. js"> </script>
------------------------------------------------------------------------
*/
Hey, in this case, the final setting of adaptive width and height can actually be proposed to be called as a function.
I didn't do this. Some friends who saw the article can encapsulate it on their own.
There are also some inconvenient ones. For example, each time I create an iframe, different names and IDs are required, and it is not possible to delete the previously created ones in real time ......
I hope you can give me more advice.