Jsp page iframe highly adaptive js Code
The following operations are written in the body, outside the form
| 1 2 3 4 5 6 7 8 9 |
<Iframe id = "agentFrame" name = "agentFrame" src = "" width = "0" height = "0" style = "display: none;"> </iframe> <Script type = "text/javascript"> Function sethash (){ HashH = document.doc umentElement. scrollHeight; // obtain the height of a file. UrlC = "/test. jsp"; // set the src of iframeA Document. getElementById ("agentFrame"). src = urlC + "#" + hashH; // pass the height as a parameter } Window. onload = sethash; </Script> |
Test. jsp is as follows:
| 1 2 3 4 5 6 7 8 9 |
<% @ Page contentType = "text/html; charset = GBK" language = "java" %> <Script> Function pseth (){ Var iObj = parent.parent.doc ument. getElementById ('infoframework '); Iobloud = parent. parent. frames ["infoFrame"]. frames ["agentFrame"]. location. hash; IObj. style. height = iobloud. split ("#") [1] + "px "; } Window. onload = pseth (); </Script> |