File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes hide a line Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "hide a line" Watch "hide a line" New topic
Author

hide a line

Sanjay Saxena
Ranch Hand

Joined: Dec 12, 2001
Posts: 81
Hi there,
I have a requirement that I have to hide and show a particular line depending upon button pressed.
currently it is implemented using DIV.
It does its work but it does not restore the space. As soon as I hide it, the current line should disappear and the line just below it should come to this line.
Can anybody help me do it. I use IE5.5.
Thanks in advance
_Sanjay
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50674

It does its work but it does not restore the space.

Do you not think it would be helpful to show us how you got it to "work"?
Without that information, I'd suspect that you are using the visibility style sheet attribute. And as you have found, that only affects the visibility of the element, not whether it is rendered or not.
What you probably want is the display CSS style attribute. Set it to block to cause the element to be rendered, and to none to cause it to be skipped.
hth,
bear


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Sanjay Saxena
Ranch Hand

Joined: Dec 12, 2001
Posts: 81
Hi Bear,
Thanks for reply.
This is how my code looks like.
**********************************************
<SCRIPT language="JavaScript1.2">
function hideHelp()
{
help.style.visibility='hidden';
document.myForm.helpbutton.value = "Hide";
}
</SCRIPT>



<DIV ID="help" style="visibility:visible; height:34px; overflow-y: auto;" >
<TABLE bgcolor="#FFFFFF" cellspacing="0" cellpadding="0" border="0" width="100%" height=34px>
<TR bgcolor="#fdfecf">
<TD width="95%"><DIV id="help_div"></DIV></TD>
<TD><INPUT type="button" name="button" value="Hide" onClick1="hideHelp()"></TD>
</TR>
</TABLE>
<INPUT type="hidden" name="helpbutton" value="">
</DIV>
*********************************************
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15003
One thing, your code will not be that browser friendly. I would look at this forum topic, there is a link there to my example for showing and hiding:

http://www.coderanch.com/t/113614/HTML-JavaScript/Div-Visibility
Also if you want the line to come up, you will have to change the height of the div.
(....).style.height=#;

Eric
 
 
subject: hide a line
 
Threads others viewed
Can I display the record No. in the client GUI?
hide splitpane divider
Can I call ancestor's method instead?
how to hide and show contents with struts2 div tag
Showing Hiding <s:div> tag in Struts2
IntelliJ Java IDE