Showhide javascript in page template
-
I am trying to include some javascript to show/hide a section with code that works fine in a html page. I have added
<script type=”text/javascript” src=”showhide.js”></script>
to the head section of header.php and my page template includes in the pagepost div:
<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>
showhide.js is in my theme directory with my theme style.css having the necessary css, #wrapper & #showhide
The first thing I see is the include file, I 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');">
Thanks, Tom.
ps. A variation of this post is in the How-To and Troubleshooting but has remained unanswered. I could not find a place to contact the moderators to move it so have reposted here.
- The topic ‘Showhide javascript in page template’ is closed to new replies.