473,837 Members | 1,532 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

show divs according to what the user clicks from a menu choice

12 New Member
yeah i need some help(such a common line) ,i have a menu and each link has its own div respectively and yeah obviously when u click the link the div shows, the problem is i would like each div to show no matter how many times you click the link for it and if you click on another one and when u go back to the original , the div would still show. at the moment i have partially done that, i click on item a ,that shows then when i click item b that shows and if i go back to item a it shows again, but i can only get it 2 wrk like that with 2 divs how do i do it so it wrks with multiple divs , so if user comes n clicks on item b it'll show, if it click on item a it'll show n if it clicks on item c it'll show and if it was to revisit item a ,b or c they all will still show.
i am i beginner so please if i have many mistakes do understand, feel free to make any corrections or if you have any better ideas,thank you
i did some testing with the swapsee bit of code by adding div 3 and 4 onto the existing code on the first line and adjusting the rest of the code accordingly but it didnt work .
here some code,
the code includes the menu code and the divs and how i have partially achieved wht i wanted as i mentioned before using the swapsee function or element:


Expand|Select|Wrap|Line Numbers
  1. <body>
  2.  
  3.     <dl id="menu">
  4.  
  5.         <dt onclick="javascript:montre('smenu2');">Beds</dt>
  6.             <dd id="smenu2">
  7.     <ul>                    <li><a href="javascript:swapSee('metal','mydiv');" onmousedown="slidedown ('mydiv');">Divans</a></li>
  8.                     <li><a href="javascript:swapSee('mydiv','metal');" onmousedown="slidedown ('metal');">Metal</a></li>
  9.                     <li><a href="javascript:swapSee('bunk','pine');" onmousedown="slidedown ('pine');">Pine</a></li>
  10.                                         <li><a href="javascript:swapSee('pine','bunk');" onmousedown="slidedown ('bunk');">Bunk</a></li>
  11.  
  12.                 </ul>
  13.  
  14. </dl>
  15. </div>
  16.  
  17. <script type="text/javascript"> 
  18. <!-- 
  19. function swapSee(div1,div2){ 
  20. var seeUm=document.getElementById(div1); 
  21. var noSee=document.getElementById(div2);
  22. seeUm.style.visibility="hidden"; 
  23. noSee.style.visibility="visible"; 
  24. //--> 
  25. </script> 
  26.  
  27.  
  28. <div id="content">
  29. <div id="mydiv"
  30. style="display: none;
  31.        overflow: hidden;
  32.        height:520px; 
  33.        width: 740px;
  34.        overflow: scroll;
  35.       border-color: purple; 
  36.       background-color: lightgreen; 
  37.       border-style: solid; 
  38.       border-width: 1px; 
  39.       color: black; 
  40.       font-weight: bold;
  41.       div align: center;
  42.       position:absolute;
  43.       left:230px;
  44.        top:90px;
  45.       ">
  46.  
  47. <h2>Divans</h2>
  48. <a href="div.html#ortho">Orthopaedic Beds</a>&emsp;&emsp;<a href="div.html#">Semi-Orthopaedic Beds</a>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;
  49. <p><A Name="ortho"></A>Orthopaedic</p>
  50.  
  51. <p>Venus ortho tufted</p>
  52. <a href="images\Venus.jpg" rel="lightbox" title="Venus">
  53. <IMG border="0" SRC="images\venus2.JPG" align="left"></a>Material: <br>Size: 14”/ 360mm standard divan base height on 2” castors<br>Product Information: Spring edge divan base option available, drawer and slidestore options also available.
  54. <BR CLEAR="all">
  55. </div>
  56.  
  57. <div id ="metal"
  58. style="display: none;
  59.        overflow: hidden;
  60.        height:520px; 
  61.        width: 740px;
  62.        overflow: scroll;
  63.       border-color: purple; 
  64.       background-color: lightgreen; 
  65.       border-style: solid; 
  66.       border-width: 1px; 
  67.       color: black; 
  68.       font-weight: bold;
  69.       div align: center;
  70.       position:absolute;
  71.       left:230px;
  72.        top:90px;
  73.        ">
  74.  
  75. <h2>Metal</h2>
  76. <p>Waverly Single</p>
  77. <a href="images\Waverly Big.jpg" rel="lightbox" title="Waverly">
  78. <IMG border="0"  SRC="images\waverly.JPG" align="left"></a>
  79. <BR CLEAR="all">
  80. </div>
  81.  
  82. <div id ="pine"
  83. style="display: none;
  84.        overflow: hidden;
  85.        height:520px; 
  86.        width: 740px;
  87.        overflow: scroll;
  88.       border-color: purple; 
  89.       background-color: lightgreen; 
  90.       border-style: solid; 
  91.       border-width: 1px; 
  92.       color: black; 
  93.       font-weight: bold;
  94.       div align: center;
  95.       position:absolute;
  96.       left:230px;
  97.        top:90px;
  98.        ">
  99. <h2>Pine</h2>
  100.  
  101. <p>Barcelona Bed</p>
  102. <a href="images\barcelona.jpg" rel="lightbox" title="Barcelona">
  103. <IMG border="0" SRC="images\barc.JPG" align="left"></a>Material: Antique Pine<br>Sizes:<br>Product Information: This has a pine slatted base, with a choice of high or low foot end. Supplied flat packed only.
  104. <BR CLEAR="all">
  105.  
  106. </div>
  107.  
  108. <div id ="bunk"
  109. style="display: none;
  110.        overflow: hidden;
  111.        height:520px; 
  112.        width: 740px;
  113.        overflow: scroll;
  114.       border-color: purple; 
  115.       background-color: lightgreen; 
  116.       border-style: solid; 
  117.       border-width: 1px; 
  118.       color: black; 
  119.       font-weight: bold;
  120.       div align: center;
  121.       position:absolute;
  122.       left:230px;
  123.        top:90px;
  124.        ">
  125. <h2>Bunk</h2>
  126. <p>Atlas Bunk</p>
  127. <a href="images\atlasbunk.jpg" rel="lightbox" title="Atlas Bunk">
  128. <IMG border="0" SRC="images\atlas.JPG" align="left"></a>Material: Aluminium<br>Sizes: 3ft<br>Product Information: Bunk bed with wooden slatted base, can also be split into 2 single beds and mattress supplied separately. Supplied flat packed only.
  129. <BR CLEAR="all">
  130. </div>
  131.  
  132.  
Jan 15 '08
21 2408
daydream
12 New Member
hey, thanks for that,it worked great! now just gonna check if its okay in all other browsers....!! thanks for the help!
Jan 18 '08 #21
gits
5,390 Recognized Expert Moderator Expert
:) no problem ... post back to the forum in case you have more questions

kind regards
Jan 18 '08 #22

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1970
by: Phil N | last post by:
Hi all. I've been here before and got a lot of help with my neophyte troubles so I'm back again. This time I have a number of questions (if I can remember them all). (I've pasted the code in question at the end of this message and installed it on the web at http://www3.telus.net/bikim/test .)
9
4584
by: Preston Crawford | last post by:
I know this is probably a dumb question so please be patient with me. I've been doing HTML since 1994, but mostly for projects that had to be as completely compatible as possible and mostly existing projects. So that meant dealing with the traditional table layouts (i.e. using tables for the entire structure of a page). I'm just not getting to use DIVs solely for the layout of a page. The one problem I'm having is that I'm trying to setup...
10
3221
by: David | last post by:
Hi everyone, Hoping there are some .js/browser experts out there that can help with this weird problem. I have made a swap div routine and applied the events to menu buttons with a closer layer behind the menus. The closer div has a lower index than the submenu divs so it appears behind them. The closer div contains a transparent gif with an event applied to it to close all of the divs when moused over.
1
2485
by: David | last post by:
Hi, I am developing a NotifyIcon app with C#. I want to show the context menu when user left-clicks on the icon, the same as he/she right-clicks on it. In that event handler, myNotifyIcon_Click(), I call myNotifyIcon.ContextMenu.Show method. But I am not sure what these two parameters I should feed. Thanks in advance.
5
3376
by: PontiMax | last post by:
Hi, when I press the OK button of my dialog box a long-running task is initiated. Therefore I would like to make visible a div section right after clicking the button where a user-friendly message is displayed... How can this be done? Can I make the section visible via server-side code? Via Response.Write()? Any examples would be appreciated!
4
13032
by: fizzyfozzy | last post by:
Hi, I am trying to figure out how to show or hide a selection of divs on my page depending on what is selected from a list/menu item, using css & javascript. I have tried to use the script listed here: http://www.thescripts.com/forum/thread88791.html but have been uable to customise it to my needs and could do with some help. My form is asking people how many tickets they would like to an event & depending on their selection I need...
2
2152
by: dusk | last post by:
Hi, I have a page with lots of hidden divs which are revealed based on choices made at each 'layer'. So I've used naming convention which represents the order in which each div becomes visible - 'a100', 'a200', 'a300' for the first 'layer'; 'b100', 'b200', 'b300' for the second; 'c100, 'c200', 'c300' for the third ... etc I'm writing the javascript functions to hide and show the appropriate divs and its getting out of hand pretty...
2
2757
by: richard | last post by:
I'm working on a menu system where I have a 3 column table affair. On start, you see a menu list in column 1. Column2 will have some general information. Column3 is an iframe for final data input. About every damn thing I've seen on how to do this is the pure bare bones basics. That is, click button 1 to hide, click button 2 to show. Not what I want. Or, they simply toggle a division below the "switch".
0
9837
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10870
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10563
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10621
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9392
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6998
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5668
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4038
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3123
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.