Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > JavaScript > Re: How to hide...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 3 Topic 35468 of 37133
Post > Topic >>

Re: How to hide parts of a do***ent, using Javascript

by Ronald Raygun <invalid@[EMAIL PROTECTED] > May 3, 2008 at 03:15 PM

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.
 




 3 Posts in Topic:
How to hide parts of a document, using Javascript
Ronald Raygun <invalid  2008-05-03 14:01:09 
Re: How to hide parts of a document, using Javascript
"Evertjan." <  2008-05-03 14:01:45 
Re: How to hide parts of a document, using Javascript
Ronald Raygun <invalid  2008-05-03 15:15:50 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 5:57:54 CDT 2008.