You are here: irt.org | FAQ | JavaScript | Frame | Q1343 [ previous next ]
First the frameset: <html> <frameset rows="50%,*"> <frame src="test.htm"> <frame name="otherFrameName" src="test1.htm"> </frameset> </html>
Then test.htm:
<script language="JavaScript"><!-- function show(w,object) { if (w.document.layers && w.document.layers[object] != null) w.document.layers[object].visibility = 'visible'; else if (document.all) w.document.all[object].style.visibility = 'visible'; } function hide(w,object) { if (w.document.layers && w.document.layers[object] != null) w.document.layers[object].visibility = 'hidden'; else if (document.all) w.document.all[object].style.visibility = 'hidden'; } //--></script> <form> <input type="button" value="show" onClick="show(parent.otherFrameName,'myLayer')"> <input type="button" value="hide" onClick="hide(parent.otherFrameName,'myLayer')"> </form>
Then test1.htm:
<style type="text/css"><!-- .myStyle { position: absolute; visibility: hidden; } //--></style> <div class="myStyle" id="myLayer"> This is a layer </div>