• I am trying to include some javascript to show/hide a section with code that works fine in a html page. My page template includes in the pagepost div:

    <div id="wrapper">
    		<script type=”text/javascript” src=”showhide.js”></script>
    <script type=”text/javascript”>
    <!–
    <a>What’s New</a>
    </script>
    <div id="showhide">
    <?php include(TEMPLATEPATH  . '/whatsnew.php'); ?>
    </div>
    </div>

    showhide.js is in my theme directory with my theme style.css having the necessary css, #wrapper & #showhide

    However the first thing I see is the include file, no what’s new anchor to show/hide…any ideas what I am doing wrong?

    Thanks, Tom.

Viewing 1 replies (of 1 total)
  • Thread Starter boardtc

    (@boardtc)

    I moved

    <script type=”text/javascript” src=”showhide.js”></script>

    to the head section of header.php and the pagepost div now includes

    <div id="wrapper">
    <script type=”text/javascript”>
    <!–
    <a onclick=”switchMenu(’showhide’);”>What’s New</a>
    //–></script>
    <div id="showhide">
    <?php include(TEMPLATEPATH  . '/whatsnew.php'); ?>
    </div>
    </div>

    I still do not see a What’s new anchor to toggle the show/hide. Any thoughts?

    I also want to have the section hidden at startup. In a regularly html page I achieve this with

    <body onload="switchMenu('showhide');">

    Please advice if another forum is more suitable.

Viewing 1 replies (of 1 total)
  • The topic ‘Showhide javascript in page template’ is closed to new replies.