javascript - Changing IFRAME height dynamically -
how possible fix height issue of google trend charts dynamically. example take on output of following code.
<iframe width="600" height="320" src="http://www.google.com/trends/fetchcomponent?hl=en-us&q=css-showcase&content=1&cid=timeseries_graph_0&export=5&w=600&h=320" style="border: none;"></iframe> <hr> first contents <hr> <iframe width="600" height="320" src="http://www.google.com/trends/fetchcomponent?hl=en-us&q=html5&content=1&cid=timeseries_graph_0&export=5&w=600&h=320" style="border: none;"></iframe> <hr> second contents
on jsfiddle: http://jsfiddle.net/yzw8y/
i didn't test it, work.
function autoresize(id) { var newheight; newheight=document.getelementbyid(id).contentwindow.document.body.scrollheight; document.getelementbyid(id).height=newheight + "px"; } <iframe id="frame1" onload="autoresize('frame1')" ... >
Comments
Post a Comment