User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 391,965 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,129 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting

Expandable Javascript Text Block Problem

Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,142
Reputation: peter_budo has a spectacular aura about peter_budo has a spectacular aura about peter_budo has a spectacular aura about 
Rep Power: 10
Solved Threads: 258
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is online now Online
Code tags enforcer

Re: Expandable Javascript Text Block Problem

  #2  
Feb 28th, 2008
I used something like this 2-3 years ago on one of my school assigmnets. Maybe it will help you...

Script in the head of html
  1. <script type="text/javascript"><!--function to hide/show submenu options-->
  2. (document.getElementById ? DOMCapable = true : DOMCapable = false);
  3.  
  4. function show(menuName)
  5. {
  6. if (DOMCapable)
  7. {
  8.  
  9. if(document.getElementById("menu1choices").style.visibility=="hidden")
  10. {
  11.  
  12. document.getElementById("menu1choices").style.display="block";
  13.  
  14. document.getElementById("menu1choices").style.visibility="visible";
  15. }
  16. else
  17. {
  18.  
  19. document.getElementById("menu1choices").style.display="none";
  20.  
  21. document.getElementById("menu1choices").style.visibility="hidden";
  22. }
  23.  
  24. }
  25. }
  26. function hide(menuName)<!--Function to hide submenu if any other option from main menu selected-->
  27. {
  28. if (DOMCapable)
  29. {
  30.  
  31. document.getElementById("menu1choices").style.display="none";
  32.  
  33. document.getElementById("menu1choices").style.visibility="hidden";
  34. }
  35. }
  36. </script>

Inside body of html
  1. <div id="menu1" onClick="show('menu1choices');">
  2. <p class="black_link" style="cursor: pointer;">Quiz</p></div>
  3. <div id="menu1choices" style="display: block; visibility: visible;">
  4. <table border="0">
  5. <tbody><tr>
  6. <td><a href="quiz1.html"
  7. target="main" class="black_smaller">Quiz 1</a></td>
  8. </tr>
  9. <tr>
  10. <td><a href="test.html"
  11. target="main" class="black_smaller">Quiz2</a></td>
  12. </tr>
  13. </tbody>
  14. </table>
  15. </div>
  16.  
  17. <script type="text/javascript">
  18. if (DOMCapable)
  19. {
  20. show("menu1");
  21. }
  22. </script>
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Reply With Quote  
All times are GMT -4. The time now is 9:14 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC