Ronald Raygun wrote on 03 mei 2008 in comp.lang.javascript
:
I have a document that is layed out in divs with ids and classes.
There can be N divs of class "other" but only one div with id ="main".
Only the div with id "main" should be visible.
It is realy simple if you know JS and CSS.
A class being a CSS attribute could also be an an attribute of your
id='main' div, so let us forget about that first:
======================
var temp = document.getElementsByTagName('div')
for (var i=0;i<temp.length;i++)
temp[i].style.display='none';
document.getElementsById('main').style.display='bl ock';
=====================
[not tested]
However, if you have other divs that should not be affected,
and want to use the class 'other', do:
======================
var temp = document.getElementsByTagName('div')
for (var i=0;i<temp.length;i++)
if (temp[i].className=='other')
temp[i].style.display='none';
document.getElementsById('main').style.display='bl ock';
=====================
>
I want to be able to programatically select the visible portion of the
Change your idea fron "visible" to "displayed" as the first in CSS slang
means that the part will be displayed empty.
document, by clicking a link at the bottom of the document. So for
example, the links at the bottom of the page will show "Page1",
"Page2" etc.
Does anyone have an example that shows how I may do this?
I leave you to change this to the buttons on the bottom.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)