
Hiding/Showing a DIV from IE and Nav
you need to set the DIV's position attribute to absolute and then specify
the top/left coordinates, if you are only displaying one div at a time the
use the following
<DIV style="position:absolute; top:100; left:-1000;" id=idDiv1>
and then you can programmatically set the left attribute to wherever on your
page you will be displaying it, so when a user select category 1 you will
programmatically change left as follows
function changeCategory(category)
{
var idDiv = document.getElementByID("idDiv"+currentCat);
idDiv.style.left=-1000;
idDiv = document.getElementByID("idDiv"+category);
idDiv.style.left=100;
currentCat = category;
Quote:
}
currentCat is a global variable that stores the category number, and
category is the passed in new category from your selection. This way with
the default set to one, when the user selects category 2 then that will be
passed into the function above and the function will hide category 1 (set
left to -1000) and show category 2 (set left to 100 or whatever you set left
to be).
Because you are using position:absolute you dont need to worry about setting
visibility or display you just set the left position of all the divs that
are not to be displayed to -1000, and this hides them off the screen and
they only appear invisible, you then set left to your value and they then
appear visible.
I hope this helps, i use this on a search engine only slightly more advanced
than i have written here. and youll need to do error checks, incase a div
doesnt exist etc.
Regards and have fun
Neil
Quote:
> Hi,
> I have a page with about 20 DIV's on it where each represents a category
of
> items selected from a table above. I found cross-browser code to modify
the
> visibility of the DIV's but I need to control the display style (the
> invisible DIVs would still take up significant space and I will only be
> showing one DIV at a time). The code needs to work with IE 4 and Nav 4
> browsers and forward.
> Thanks for any help. Also do you have any recommendations for a good
> cross-browser book/site for future reference?