有人在群里问如何在iframe框架加个打开和关闭的按钮,当单击“打开”按钮就让iframe显示出来,当单击“关闭”按钮就隐藏iframe,这个功能群中给出了解决方法 具体实现操作如下: <script language="JavaScript"> var act; function over(){ var h = parseInt(mytd.height); if (h <= 400){ mytd.height = h + 20; clearTimeout(act); act = setTimeout('over()', 10); } } function out(){ var h = parseInt(mytd.height); if (h >= 0){ mytd.height = h - 20; clearTimeout(act); act = setTimeout('out()', 10); } } </script> <input name="Submit" type="button" id="Submit" onClick="over()" value="打开"> <input name="Submit2" type="button" id="label" onClick="out()" value="关闭"> <table width="316" height="1" cellpadding="0" cellspacing="0" id="mytd" > <tr> <td ><iframe width="760" height="100%" src="" FRAMEBORDER=0 scrolling="no"></iframe></td> </tr> </table> |
|