PDA

View Full Version : Resize iframe with buttons?



Agent Moose
12-22-2006, 05:02 PM
I am trying to make a code that uses buttons to resize the Iframe. When you press the "+" the iframe width gets bigger, and when I press "-" the iframe gets smaller. I have three diffrent iframes in the code I am useing. I already have buttons for the three diffrent iframes made, there are three diffrent names for them, a, b and c. That is also the names of each of the iframes...


<input type="button" value=" + " onclick="std_window_resize( 100 )" name="c"/>
<input type="button" value=" - " onclick="std_window_resize( -100 )" name="c"/>
Here is the accuall code, so if someone wants to help, please do!

<script>
function show(which) {
var hide = new Array();
hide = document.getElementsByName(which);
for (i=0; i<hide.length; i++) {
hide[i].style.display = 'inline';
}
}
function hide(which) {
var hide = new Array();
hide = document.getElementsByName(which);
for (i=0; i<hide.length; i++) {
hide[i].style.display = 'none';
}
}
</script>
<style type="text/css">
iframe { display: none; }
</style>
<table cellpadding="0" cellspacing="0" style="padding:0px;margin:0px;" id='std-table-buttons' width="100%">
<tr><td style="padding:0px;margin:0px;" align="center" width="1%" valign='top' nowrap="nowrap"><b>SMFFF Support</b>
<input type="button" value="Show" onclick="show('a');">
<input type="button" value="Hide" onclick="hide('a');"></td>
<td style="padding:0px;margin:0px;height:0px" align="right" valign='top' width="99%">
<input type="button" value=" + " onclick="std_window_resize( 100 );" name="a"/>
<input type="button" value=" - " onclick="std_window_resize( -100 );" name="a"/>
</td></tr></table>

<iframe src='http://www.smfsupport.com/support/' width='100%' height='100%' scrolling='yes' name='a'></iframe>

<hr />

<table cellpadding="0" cellspacing="0" style="padding:0px;margin:0px;" id='std-table-buttons' width="100%">
<tr><td style="padding:0px;margin:0px;" align="center" width="1%" valign='top' nowrap="nowrap"><b>Google</b>
     <input type="button" value="Show" onclick="show('b');">
<input type="button" value="Hide" onclick="hide('b');"></td>
<td style="padding:0px;margin:0px;height:0px" align="right" valign='top' width="99%">
<input type="button" value=" + " onclick="std_window_resize( 100 );" name="b"/>
<input type="button" value=" - " onclick="std_window_resize( -100 );" name="b"/>
</td></tr></table>

<iframe src='http://www.google.com' width='100%' height='100%' scrolling='yes' name='b'></iframe>

<hr />

<table cellpadding="0" cellspacing="0" style="padding:0px;margin:0px;" id='std-table-buttons' width="100%">
<tr><td style="padding:0px;margin:0px;" align="center" width="1%" valign='top' nowrap="nowrap"><b>Google</b>
     <input type="button" value="Show" onclick="show('c');">
<input type="button" value="Hide" onclick="hide('c');"></td>
<td style="padding:0px;margin:0px;height:0px" align="right" valign='top' width="99%">
<input type="button" value=" + " onclick="std_window_resize( 100 )" name="c"/>
<input type="button" value=" - " onclick="std_window_resize( -100 )" name="c"/>
</td></tr></table>

<iframe src='http://www.google.com' width='100%' height='100%' scrolling='yes' name='c'></iframe>