繁体   English   中英

按下按钮后如何调整iframe?

[英]How can i adjust an iframe after a button press?

我试图在按下按钮后调整iframe。 问题是,当您按下按钮并寻找航班时(例如从马德里飞往巴塞罗那),并向您显示航班,就会出现第二个滚动条(主页滚动条和iframe滚动条)。 如何根据搜索结果调整iframe的高度以使用主滚动条? 代码在这里:

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Probando la altura fija</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <style type="text/css"> html { height: 100%; } body { height: 100%; margin: 0px; padding: 0px; } </style> </head> <body> <iframe src='http://www.dohop.com/widget/2/?forms=flights&target=&tabs=top&orientation=horizontal&border_color=808080&text_color=202020&background_color=D0D0D0&form_border_color=808080&form_text_color=000&form_background_color=FAFAFA&width=1000&flang=es&whitelabel=http://vuelos.gangatravel.es/' scrolling='yes' width='1000' height='250' frameborder='0' style='border:none; overflow: hidden;' allowtransparency='true'> </iframe> <div style='text-align: right; width: 1000px; display:block; margin-top:5px;'> <a href='http://www.dohop.com' style='font-size:10px;text-decoration:none;color:#007BA4;'></a> </div> </body> </html> 

谢谢!!

<div id='iframe_holder' style="overflow:hidden" > 
   <iframe style="width:100%;height:100%"></iframe>
</div>

您可以通过js控制div的尺寸和位置,iframe会调整其滚动条。


要么

var ifr_document = document.getElementById("iframe_id").contentWindow.document;
var target = ifr_document.getElementById("element_to_control");

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM