Home >Web Front-end >JS Tutorial >JavaScript processing Iframe adaptive height (under the same or different domain names)_javascript skills

JavaScript processing Iframe adaptive height (under the same or different domain names)_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:38:581481browse
1. Processing of Iframe adaptive height under the same domain name
Copy the code The code is as follows:




Tail




iframe nested page iframe.html
Copy code The code is as follows:



Iframed page

Text< ;br />









Text





< ;br />



Text









Text










< ;script type="text/javascript">
function sethash(){
hashH = document.documentElement.scrollHeight;
urlC = "agent.html";
document.getElementByIdx("iframeC ").src=urlC "#" hashH;
}
window.onload=sethash;




iframe intermediary page agent.html
Copy code The code is as follows:

< ! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

iframe intermediary page