|
有人在群里問如何在iframe框架加個打開和關(guān)閉的按鈕,當(dāng)單擊“打開”按鈕就讓iframe顯示出來,當(dāng)單擊“關(guān)閉”按鈕就隱藏iframe,這個功能群中給出了解決方法 具體實(shí)現(xiàn)操作如下: <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="關(guān)閉"> <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> |
|
|