javascript,js,简单的iframe高度自适应
共两个文件
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>jquery</title> <style type="text/css"> </style> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <!-- <script type="text/javascript" src="https://getfirebug.com/firebug-lite.js"></script> --> <script type="text/javascript"> </script> </head> <body> <div id="p_iframe" style="display:block"> <iframe id="my_iframe" scrolling="auto" src="http://localhost/test/test2.html"></iframe> </div> </body> </html>
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <title>iframe src</title> <script type="text/javascript"> $(document).ready(function (){ alert('ee'); parent.document.getElementById("my_iframe").height=parseInt(document.documentElement.scrollHeight)+0; alert('ddd'); }); </script> </head> <body> <br /><br /> 用户名:<input type="text" /><br /><br /><br /> 密 码:<input type="password" /><br /><br /><br /> <input type="button" value="提交"/><br /><br /><br /> <input type="reset" value="重置"/> </body> </html>
相关推荐
nmgxzm00 2020-11-10
ifconfig 2020-10-14
hhanbj 2020-11-17
zfszhangyuan 2020-11-16
古叶峰 2020-11-16
一个智障 2020-11-15
jipengx 2020-11-12
81427005 2020-11-11
xixixi 2020-11-11
游走的豚鼠君 2020-11-10
苗疆三刀的随手记 2020-11-10
Web卓不凡 2020-11-03
小飞侠V 2020-11-02
帕尼尼 2020-10-30
爱读书的旅行者 2020-10-26
帕尼尼 2020-10-23
杏仁技术站 2020-10-23
淼寒儿 2020-10-22