How can I increase/Descrease font size of I frame content from outside the Iframe
my I frame Id ="AIO"
i need to create 2 buttons 1 for increasing the font and the other fr decreasing it any suggestions?
by far this is not working :
function changefont()
{
var x=document.getElementById("AIO");
var y=(x.contentWindow || x.contentDocument);
if (y.document)y=y.document;
y.document.body.indec++;
}
The clue here is, that it won't work on Your desktop. You need to test it on Your server. If You copy both files to
/path/to/your/server/root/test
and view
http://localhost/test
You will see the result. One more thing: working with iframes is a really restrictive task both sites (parent and iframe) need to be on the same server (same protocol, host, port).
senior_oracl...
Member
30 Points
165 Posts
increase font size of iframe contents
Nov 29, 2012 02:10 PM|LINK
How can I increase/Descrease font size of I frame content from outside the Iframe
my I frame Id ="AIO"
i need to create 2 buttons 1 for increasing the font and the other fr decreasing it any suggestions?
by far this is not working :
function changefont() { var x=document.getElementById("AIO"); var y=(x.contentWindow || x.contentDocument); if (y.document)y=y.document; y.document.body.indec++; }QuantumInfor...
Member
199 Points
228 Posts
Re: increase font size of iframe contents
Nov 29, 2012 04:49 PM|LINK
You can access the dom of an iframe and manipulate that:
----------------------------------
¦ Main page¦
¦ ¦
¦ ------------------------ ¦
¦ ¦ IFramed page ¦ ¦
¦ ¦ ¦ ¦
¦ ¦ ¦ ¦
¦ ¦ ¦ ¦
¦ ¦ ¦ ¦
¦ ------------------------ ¦
¦ ¦
¦ ¦
----------------------------------
Oneway is just use JavaScript (or JQuery) to pick the info. up from the IFramed stuff.
document.frames["ID GIVEN TO THE IFRAME"].document.getElementById("ID TO change font")
raju dasa
Star
14730 Points
2496 Posts
Re: increase font size of iframe contents
Nov 30, 2012 05:25 AM|LINK
Hi,
Try this code:
or check site:
http://www.sitepoint.com/forums/showthread.php?106480-Changing-the-font-of-a-quot-iframe-quot
rajudasa.blogspot.com || blog@opera
RameshRajend...
Star
7983 Points
2099 Posts
Re: increase font size of iframe contents
Nov 30, 2012 05:49 AM|LINK
Try it
#site.html <iframe id="iFrame" name="iframe" src="iframe.html"></iframe> <script type="text/javascript"> ;(function($) { $(function() { var iframe = top.frames['iframe'].document; $('p', iframe).css('font-size','5px'); }); })(jQuery); </script> #iframe.html <p>some test content</p>The clue here is, that it won't work on Your desktop. You need to test it on Your server. If You copy both files to
and view You will see the result.One more thing: working with iframes is a really restrictive task both sites (parent and iframe) need to be on the same server (same protocol, host, port).
http://www.codeproject.com/Questions/403135/change-font-size-in-iframe