![]() |
CSS/JS - Div show hide
I need a script that will allow me to show hide content inside of a div. I managed to get one working fine, super simple - but my JS sucks so I can't build on it.
I need for when you click a SECOND link the div opens and closes any other opened divs of the same class/ID. So basically just a tab system. Anyone have a super simple one available? |
function showDiv(x){
if(document.getElementById(x).style.display == 'none'){ document.getElementById(x).style.display = ''; } else { document.getElementById(x).style.display = 'none'; } } <input type="button" onclick="showDiv('divname');"> That one won't work the other "tabs" but it's pretty easy to add in.... |
yea that's pretty much what I have already. it keeps the old div open when you click a new one. means if I have 19 elements, they all get stacked. I want to close previous ones when a new one is opened.
|
http://fdsign.com/jeff/ams-final2/products.html
choose a product and click "supplement facts" to see it work code: Code:
<SCRIPT LANGUAGE="JavaScript"> Code:
<DIV Name="id2" ID="id2" style="display:none; width:98%;height:auto;position:middle center;z-index:100;"> |
|
I think i just made a mess in my pants...
CSS and JS makes me hard! |
Try changing the z-layer
|
If you happen to use dreamweaver cs3, search for spry tutorial on youtube, it's super easy to setup even for someone who doesn't know shit about javascript...
|
Quote:
|
www.dynamicdrive.com should have what you're looking for, and if they dont they'll custom tweak stuff in the forum for you. very helpful site and users helping each other out
|
I use jquery for stuff like that. Sounds like you're looking for something like this... http://docs.jquery.com/UI/Accordion
I've tried mootools and prototype and like jquery the most. Even if you aren't great with JS, this helps a ton. |
Quote:
|
All times are GMT -7. The time now is 06:05 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123