Title: Hide/show pages with javascript
Last modified: August 19, 2016

---

# Hide/show pages with javascript

 *  [alessandrobaffa-1](https://wordpress.org/support/users/alessandrobaffa-1/)
 * (@alessandrobaffa-1)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/hideshow-pages-with-javascript/)
 * Hi everybody, i don’t know if it’s right to write here this kind of problem, 
   so i try ..
    I’d like to insert a javascript effect in my WordPress template,
   in such a way that it is possible to click on menu items and change only a DIV
   just after the menu. I’ll try to explain better what i mean. I have a menu with
   this kind of links `<a href="javascript:;" onmousedown="toggleDiv('slickbox');"
   title="Browse the archives">browse</a>`, _toggleDiv_ is a call to a javascript
   function, which is the following:
 *     ```
       function toggleDiv(divid){
   
         if(document.getElementById(divid).style.display == 'none'){
       	document.getElementById(divid).style.display = 'block';
         }else{
           document.getElementById(divid).style.display = 'none';
         }
       }
       ```
   
 * .
    This function takes the _divid_ parameter, finds the _DIV_ with this _id _attribute
   and makes it visible. The DIV code is the following:
 *     ```
       <div id="about" style="display:none;">
       		<div id="slickcats">
       			<ul id="script" class="headcats">
                                  HERE WILL BE SOME TEXT
       			</ul>
       		</div>
       </div>
       ```
   
 * .
 * I have downloaded the “[Improved Include Pages](http://www.vtardia.com/blog/improved-include-page/)”
   plugin, that allows me to include the content of a page in another one adding
   a string like this:`<?php iinclude_page(11); ?>`.
    My target is to have a DIV
   in my home page that changes its content dinamycally with the link a click, and
   this content are the pages. But i don’t know how to do. Now i have as many _DIV_s
   as the links in my menu, but i’d like to have only one DIV that dinamically changes.
 * There’s someone who can help me?
    Thanks!

Viewing 1 replies (of 1 total)

 *  Thread Starter [alessandrobaffa-1](https://wordpress.org/support/users/alessandrobaffa-1/)
 * (@alessandrobaffa-1)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/hideshow-pages-with-javascript/#post-750456)
 * To explain better: i want to have a code made in this way
 *     ```
       <div id="about" style="display:none;">
       		<div id="slickcats">
       			<ul id="script" class="headcats">
                                  <?php iinclude_page(DINAMICALLY CHANGES); ?>
       			</ul>
       		</div>
       </div>
       ```
   
 * and i’d like to obtain a way to change the `<?php ...?>` everytime i click in
   a different link of my menu. I have already tried to change the innerHTML property
   of the
    -  tag in the javascript function, but it seems like it doesn’t accept a string
      like this “<?php … ?>”. The script stops putting this string in the innerHTML.

Viewing 1 replies (of 1 total)

The topic ‘Hide/show pages with javascript’ is closed to new replies.

## Tags

 * [hide](https://wordpress.org/support/topic-tag/hide/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [pages](https://wordpress.org/support/topic-tag/pages/)
 * [show](https://wordpress.org/support/topic-tag/show/)

 * In: [Everything else WordPress](https://wordpress.org/support/forum/miscellaneous/)
 * 1 reply
 * 1 participant
 * Last reply from: [alessandrobaffa-1](https://wordpress.org/support/users/alessandrobaffa-1/)
 * Last activity: [18 years, 1 month ago](https://wordpress.org/support/topic/hideshow-pages-with-javascript/#post-750456)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
