...

View Full Version : hide an iframe



jewel
08-11-2005, 11:38 AM
how can i add a frame? I tried this but it doesn't work

please help

thanks,


<IFRAME id="frDocViewer" name="frDocViewer" height="75%" width="100%" frameborder="no" ></IFRAME>
<script language="javascript">
function HideFrame(){
var fr = document.getElementById ("frDocViewer");
fr.style.display="none";
}

</script>

jewel
08-11-2005, 12:01 PM
and also how to unhide?

thanks

vwphillips
08-11-2005, 01:58 PM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title></title>
</head>

<body>
<input type="button" value="Hide/Show" onclick="HideFrame();" />
<IFRAME id="frDocViewer" src="http://www.vicsjavascripts.org.uk" name="frDocViewer" height="75%" width="100%" frameborder="1" ></IFRAME>
<script language="javascript">
function HideFrame(){
fr = document.getElementById ("frDocViewer");
if (fr.style.display!='none'){
fr.style.display="none";
}
else {
fr.style.display="block";
}
}

</script>
</body>

</html>

coothead
08-11-2005, 02:01 PM
Hi there jewel.

and a warm welcome to these forums. :)

Try it like this....

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>hide/show iframe</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>

<style type="text/css">
<!--
html,body {
height:100%;
background-color:#eef;
}
#click {
width:300px;
line-height:30px;
font-family:verdana,arial,helvetica,sans-serif;
font-size:16px;
color:#666;
text-align:center;
background-color:#fff;
border:3px double #666;
cursor:pointer;
margin:20px auto;
}
#frDocViewer {
width:100%;
height:75%;
}
-->
</style>

<script type="text/javascript">
<!--
function HideFrame() {
var fr = document.getElementById ("frDocViewer");
if(fr.style.display=="none") {
fr.style.display="block";
}
else {
fr.style.display="none";
}
}
//-->
</script>

</head>
<body>

<div id="click" onclick="HideFrame()">hide/show iframe</div>


<iframe id="frDocViewer" src="http://www.codingforums.com/showthread.php?t=65683" frameborder="1" ></iframe>


</body>
</html>

coothead

iota
08-11-2005, 02:07 PM
So great and Nice. :thumbsup:

jewel
08-12-2005, 02:19 AM
Thanks everyone :)

wonfineday
04-23-2009, 07:55 PM
How can I create multiple IFRAMES (or frames) on a page that have variable height?

To illustarte the point think of it that I want a page that will have my menus on top, then a page (of indeterminate length) from abc.com and then another page from def.com, and so on...

Please help!! Thanks!!
--



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum