Evertjan. wrote:
> Ronald Raygun wrote on 03 mei 2008 in comp.lang.javascript:
>
>
>>I have a do***ent that is layed out in divs with ids and cl*****.
>>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 = do***ent.getElementsByTagName('div')
> for (var i=0;i<temp.length;i++)
> temp[i].style.display='none';
> do***ent.getElementsById('main').style.display='block';
> =====================
>
> [not tested]
>
> However, if you have other divs that should not be affected,
> and want to use the class 'other', do:
>
> ======================
> var temp = do***ent.getElementsByTagName('div')
> for (var i=0;i<temp.length;i++)
> if (temp[i].className=='other')
> temp[i].style.display='none';
> do***ent.getElementsById('main').style.display='block';
> =====================
>
>
>>I want to be able to programatically select the visible ****tion of the
>
>
> Change your idea fron "visible" to "displayed" as the first in CSS slang
> means that the part will be displayed empty.
>
>
>>do***ent, by clicking a link at the bottom of the do***ent. 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.
>
>
Thanks very much. This provides me with a very good starting ground.


|