Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Collapsible iFrame

Status
Not open for further replies.

dweeble

Technical User
Jan 3, 2006
6
Hello,
I have this script and on loading the iFrame by default is open, its got me. What am I missing to make the iFrame closed by default on open ? Thanks for any help..
Mike
--------------------------------------------------------
<html>
<head>
<script language="JavaScript">

function styleMenu(currMenu) {
thisMenu = document.getElementById(currMenu)
if (thisMenu.style.display=="")
{thisMenu.style.display="none";}
else
{thisMenu.style.display="";
source=document.getElementById('select_menu').options[document.getElementById('select_menu').selectedIndex];
document.getElementById('style_frame').src = source.value;}

}
</script>

</head>
<body topmargin="0" leftmargin="0" >
<br>
<SELECT id="select_menu" style="visibility:hidden">
<option value="</SELECT>
<br>
<input type="button" id="toggle" value="Search" onclick="styleMenu('style_frame');">
<IFRAME id="style_frame" name="style_frame" width="100%" scrolling="yes" height="100%%"></IFRAME>
<br>&nbsp;</body></html>

---------------------------------------------------
 
Make the changes denoted in red:
Code:
<html>
<head>
<script language="JavaScript">

function styleMenu(currMenu) {
thisMenu = document.getElementById(currMenu)
if (thisMenu.style.display=="")
    {thisMenu.style.display="none";}
else
    {thisMenu.style.display="";
    source=document.getElementById('select_menu').options[document.getElementById('select_menu').selectedIndex];
    document.getElementById('style_frame').src = source.value;}

}
 </script>
[!]<style type="text/css">

iframe#style_frame {
   display:none;
}

</style>[/!]
</head>
<body topmargin="0" leftmargin="0" >
<br>
<SELECT id="select_menu" style="visibility:hidden">
    <option value="[URL unfurl="true"]http://www.google.com#style5A">1st</option>[/URL]
</SELECT>
<br>
<input type="button" id="toggle" value="Search" onclick="styleMenu('style_frame');">
<IFRAME id="style_frame" name="style_frame" width="100%" scrolling="yes" height="100%%"></IFRAME>
<br>&nbsp;</body></html>

-kaht

[small](All puppies have now found loving homes, thanks for all who showed interest)[/small]
 
kaht
Oh that is it,, thanks very much.
Michael
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top