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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Making Divs invisible, or set not to display. 1

Status
Not open for further replies.

miikel

ISP
Jul 28, 2004
21
GB
I am trying to make a div disappear when check box is checked, but am unable to get the block to go invisible. I have tried using the Visibility property in css and (code below) the display property, neither of which make the div invisible.
I know the mouse over events work, as I have added a test to change the colour in the box on mouseover, and this occurs. It just seems to be ignoring the display command (or the Visibility - when I was using that).
Any suggestions, please??
<SCRIPT language="JavaScript" type="text/javascript">
function hide()
{
var obj=document.getElementById("Name").style
obj.Display='None';
}
function show()
{
var obj=document.getElementById("Name").style
obj.Display='in-line';

}
</SCRIPT>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</HEAD>

<BODY>
<DIV id="Name" class="paper" onMouseOver="hide()" onMouseOut="show()">

Hello
</DIV>

</BODY>
</HTML>
 
I always use the visibility property and it works fine... are you sure you were refrencing it correctly?

[conehead]
 
I'll give it another go and post the code if it doesn't work... Thanks for the reply...
 
Here are the functions Im using with Visibility.
Anything up with these??
Its prolly summat obvious, but Ive been staring at them all day now!!!


function hide()
{
var obj=document.getElementById("Name").style
obj.Visibility='Hidden';

}
function show()
{
var obj=document.getElementById("Name").style
obj.Visibility='Visible';

}
 
:~/
The case was wrong!!!
In my defence, Ive been working in VB for a while now and just switched to JS - so am not used to case sensitivity! Thats my excuse and I'm sticking to it!!

function hide()
{
var obj=document.getElementById("Name").style
obj.visibility='hidden';

}
function show()
{
var obj=document.getElementById("Name").style
obj.visibility='visible';

}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top