Hi,
I am dynamically generating a html file which will contain only <div> tags which contents are hidden from user( set by style="visibility:hidden")
Now the next step is i am enabling some of these tags by setting style="visible" here the problem is, the hidden items also occupy the space on html form is there any other ways such that all the content should present on html form in hidden form and run time I can make visible some of them as per requirement thru javascript?
CSS "visibility" property hides an element but retains its space in the flow of the document. If you want to remove an element from the flow of a document (not just make it invisible, but allocate its space to other elements, which is what I think you want to do) then use "display: none".
This file will include all the content of above html file under body tag using Shtml include tag.
A java script function will make the Line1 and Line4 visible.
Now my target is to show the visible lines one by one. In current situation it appears as:
Line1
<blank>
<blank>
Line4
<blank>
Is there any alternative to this implementation?
Please guide me..
Thanks
-Parag
Using javascript you can do this:
[html]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Test</title>
<script type="text/javascript">
function dispHandle(obj)
{
if (obj.style.display == "none")
obj.style.display = "";
else
obj.style.display = "none";
}
@parag1234567
hi
you can put per element of form in a cell of table
an allocate id to per cell
then you should write a fuction
that show or hide per cell with display properties
document.all[id].style.display="none" for hide cell this code for IE
or
document.layers[id].display="none" for hide cell this code for netscape
and with allocate "" to this property cell has shown
be successful
There's no need for a table. Any container element (span/div/p, etc.) will do.
Your suggestion of document.all and document.layers is very old and unsupported in most modern browsers. Use the standard document.getElementById() to refer to elements.