Forum Moderators: phranque

Message Too Old, No Replies

Make iframe invisible onclick

         

walker

12:56 pm on Jan 26, 2005 (gmt 0)

10+ Year Member



Hi

I need to make an Iframe invisible onclick but can't seem to get it to work:

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

<script>
var TestName = document.getElementById("TestFrame")
</script>

<iframe id="TestFrame" src="c:\test.htm" style="height: 100; width: 100;"></iframe>

<a href="#" onClick="document.TestName.style.display=none">Click Here</a>
</body>

</html>

Perhaps I'm being totally BLONDE but any help would really be great!

Thanks!

Walker

walker

1:08 pm on Jan 26, 2005 (gmt 0)

10+ Year Member



Worked it out!

For anyone who might need it in the future:

<script>

function CloseWindow() {

var TestName = document.getElementById("TestFrame")
TestName.style.display='none'

}
</script>

<iframe id="TestFrame" src="c:\test.htm" style="height: 100; width: 100;"></iframe>

<a href="#" onClick="CloseWindow()">Click Here</a>

Kind Regards

Walker

nonstop

5:56 am on Jan 30, 2005 (gmt 0)

10+ Year Member Top Contributors Of The Month



Cheers!

it works for

<div>
tags too


<script>

function CloseWindow() {

var TestName = document.getElementById("TestFrame")
TestName.style.display='none'

}

function showWindow() {

var TestName = document.getElementById("TestFrame")
TestName.style.display=''

}

</script>

something<br><br>

<div id="TestFrame">

some text here
some text here
some text here
some text here
some text here
some text here
some text here
some text here
some text here
some text here
some text here
some text here
some text here
some text here
some text here
some text here
some text here
some text here

</div>

<!-- <iframe id="TestFrame" src="c:\test.htm" style="height: 100; width: 100;"></iframe> -->

<a href="#" onClick="CloseWindow()">Hide text</a>

<a href="#" onClick="showWindow()">Show Text</a>

<br><br>something