JavaScript - Show/ Hide Divs In A Questionnaire
I am trying to create a questionnaire that only reveals some of the questions when certain answers to previous questions are given.
i.e. if the answer to question 1 is Yes, then question 2 appears under it. If the answer is No then question 3 appears instead. At the moment, however, is does nothing. I know the javascript I'm using should work, as I have used it on a website before, but not in this context. Can anyone see what I'm doing wrong? The javascript I have writen for this is: Code: <script> function showdiv(name){ var obj = (document.getElementById)? document.getElementById(name) : eval("document.all[name]"); if (obj.style.display=="none"){ obj.style.display=""; }else{ obj.style.display="none"; } } </script> The CSS is: Code: #q1 { } #q2 { display:none; margin-top: 10px; } #q3 { display:none; margin-top: 10px; } and the HTML is: Code: <div id="main"> <div id="q1"> <p>This is question 1</p> <input type=button value="No" onclick="showdiv('q2');"/> <input type=button value="Yes" onclick="showdiv('q3');"/> </div> <div id="q2"> <p>This is question 2</p> <input type=button value="Yes"/> <input type=button value="No"/> </div> <div id="q3"> <p>This is question 3</p> <input type=button value="Yes"/> <input type=button value="No"/> <input type=button value="Maybe"/> </div> </div> Similar TutorialsHello all, I'm still learning java. I have the concept of hide/show down, but want I want to do is when a div is shown, all the other divs are hidden, and when I click on another div to show, the other one hides, etc. This is my code for jquery show/hide: Code: <script type="text/javascript"> $(document).ready(function(){ $('#{field_label}').hide(); $('input#show{field_label}').click(function(){ $('#{field_label}').show('fast'); }); $('input#close{field_label}').click(function(){ $('#{field_label}').hide('fast'); }) }); </script> What do I need to add so that the previous DIV that was open, auto closes when a NEW DIV is enabled to show. Much appreciated Coders! Hi guys, another day, another problem I have a select: Code: <label for="tiers">Number of tiers</label> <select name="tiers" id="tiers" onchange="showtiers()"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> </select> So depending what the user will choose, I want to show below divs: Code: <div class="tier" id="tier_1" style="display:block"> <label for="tier1">Tier 1</label> <select name="item" id="tier1" onchange="recalculate(this)"> <option value="0">Please choose1</option> </select> </div> <div class="tier" id="tier_2" style="display:none"> <label for="tier2">Tier 2</label> <select name="item" id="tier2" onchange="recalculate(this)"> <option value="0">Please choose2</option> </select> </div> <div class="tier" id="tier_3" style="display:none"> <label for="tier3">Tier 3</label> <select name="item" id="tier3" onchange="recalculate(this)"> <option value="0">Please choose3</option> </select> </div> <div class="tier" id="tier_4" style="display:none"> <label for="tier4">Tier 4</label> <select name="item" id="tier4" onchange="recalculate(this)"> <option value="0">Please choose4</option> </select> </div> As you can see, on page load you can only see select/div nr 1, three others are hidden. How can I make that happen? I'm trying with below code placed in the head: Code: function showtiers() { var dropdownIndex = document.getElementById('tiers').selectedIndex; var dropdownValue = document.getElementById('tiers')[dropdownIndex].value; if (dropdownValue == 2) { document.getElementById(tier_2).style.display = 'block'; document.getElementById(tier_3).style.display = 'none'; document.getElementById(tier_4).style.display = 'none'; } if (dropdownValue == 3) { document.getElementById(tier_2).style.display = 'block'; document.getElementById(tier_3).style.display = 'block'; document.getElementById(tier_4).style.display = 'none'; } if (dropdownValue == 4) { document.getElementById(tier_2).style.display = 'block'; document.getElementById(tier_3).style.display = 'block'; document.getElementById(tier_4).style.display = 'block'; } } If someone could point out what am I doing wrong I'd really appreciate it. I have a page where it has anchors going to different parts of the page and i have a list of links at the top to go to each anchor. when you click on the links to each part of the page it shows the "back to top, next, back" buttons. I have 7 different links, so i need to have this happen 7 times, I only want the "back to top, next, and back" buttons to be shown when the user clicks on the link to that specific anchor, or the next/back button to that anchor from another one. I have been doing this with the div hide/show javascript however it makes me have to change sooo much information to do this.. There has got to be an easier way.. It would take me forever to finish doing this to all of them, i need a better way to achieve this. There's too much code that its confusing. this is my current javascript: var ie = (document.all) ? true : false; function hideID(objID){ var element = (ie) ? document.all(objID) : document.getElementById(objID); element.style.display="none" } function showID(objID){ var element = (ie) ? document.all(objID) : document.getElementById(objID); element.style.display="block" } And this is just one of the links: <li><a onclick="showID('1939top'); showID('1939next');hideID('1940top'); hideID('1941top'); hideID('1942top'); hideID('1943top'); hideID('1944top'); hideID('1945top');" href="#1939">1939</a></li> And this is one of the back to top/next button codes: <a href="#1940"><span id="1939next" class="next-back" onclick="hideID('1939next'); hideID('1939top')"><div class="arrow-down"></div></span></span></a> <a href="#top"><span id="1939top" class="timeline-b2top" onclick="hideID('1939top')">Top</span></a><a name="1939" id="1939"></a> This code has always been a huge problem for me, not only does it take forever to change the effects and all, but it is VERY messy and I really need some help on how to code it lol. Thanks so much. Hi, I am new to javascript so any help would be much appreciated. I found the following script online to show/hide a login div. <script language="JavaScript" type="text/javascript"> function login(showhide){ if(showhide == "show"){ document.getElementById('popupbox').style.visibility="visible"; }else if(showhide == "hide"){ document.getElementById('popupbox').style.visibility="hidden"; } } </script> It works really well but I have other div I would also like to show/hide. Is it possible to have a variable in the function that I could pass the name of the div to show/hide. I have a ul list that I am using for a navigation menu and I would like to be able to click on items in the list to show different div's. I assume this is possible, so could someone please give me an indication of how to do it as I have been trying for a few days now and no joy. Thanks, James Hi ya all, how can I show / hide the content of sub divs based on whether the input is != or = and be able to repeat this. I tried to hide the sub divs using , onclick if bla bla = '' ; Code: document.getElementById('hideme').innerHTML = ''; which works, but once I try to enter a new input, then nothing happens, even if the content of the sub divs is = input thx I am using the following code to show / hide form elements within a div based upon the drop down choice. Does anyone know how this code can be amended to use multiple drop downs within one form? Code: <html> <head> <title>Show and Hide</title> <script> //********************************************* // Function that Shows an HTML element //********************************************* function showDiv(divID) { var div = document.getElementById(divID); div.style.display = ""; //display div } //********************************************* // Function that Hides an HTML element //********************************************* function hideDiv(divID) { var div = document.getElementById(divID); div.style.display = "none"; // hide } //***************************************************************************** // Function that Hides all the Div elements in the select menu Value //***************************************************************************** function hideAllDivs() { //Loop through the seclect menu values and hide all var selectMenu = document.getElementById("selectMenu"); for (var i=0; i<=selectMenu.options.length -1; i++) { hideDiv(selectMenu.options[i].value); } } //********************************************* // Main function that calls others to toggle divs //********************************************* function toggle(showID) { hideAllDivs(); // Hide all showDiv(showID); // Show the one we asked for } </script> </head> <body onload="hideAllDivs();"> <select id="selectMenu" onchange="toggle(this.options[this.options.selectedIndex].value)"> <option value="formNumber1"> Show Form 1 </option> <option value="formNumber2"> Show Form 2 </option> <option value="formNumber3"> Show Form 3 </option> <option value="formNumber4"> Show Form 4 </option> </select> <div id="formNumber1"> I am Form Number one. Any content within this div will be showed</div> <div id="formNumber2"> I am Form Number two. Any content within this div will be showed</div> <div id="formNumber3"> I am Form Number three. Any content within this div will be showed</div> <div id="formNumber4"> I am Form Number four. Any content within this div will be showed</div> </body> </html> Thanks in advance! Trying to get the divs to switch style properties when selected form select menu. Any help would be great! Code: <script type="text/javascript"> function showstuff(element){ if(document.getElementById(element).style.display = 'block') { document.getElementById(have).style.visibility="block"; document.getElementById(look).style.visibility="none"; } else if(document.getElementById(element).style.visibility = 'block') { document.getElementById(look).style.visibility="block"; document.getElementById(have).style.visibility="none"; } } </script> <select name="type" onchange="showstuff(this.value);"> <option value="look">Look</option> <option value="have">Have</option> </select> <div id="have" style="display:block;">Have</div> <div id="look" style="display:none;">Look</div> Hi everyone, was wondering if someone would be able to help me out, and correct this, or suggest an alternative. I have hidden divs, and I have achieved easily and simply this with the following, but on click I want the other divs to hide so that they all can't be displayed at once, at the moment they just stack up on top of each other. I'm trying to keep it as simple as possible as i'm much the novice Code: <script> function showhide(id){ if (document.getElementById){ obj = document.getElementById(id); if (obj.style.display == "none"){ obj.style.display = ""; } else { obj.style.display = "none"; } } } } </script> and then <a href="#" onclick="showhide('divname'); return(false);"> Thanks in advance ok trying to get a Div tag to show if something is True and hide if something is False JS Code: unction eToggle(anctag,darg) { var ele = document.getElementById('Module1'); var ele = document.getElementById('Module2'); var ele = document.getElementById('Module3'); var ele = document.getElementById('Module4'); if("module1" + "module2" + "module3" + "module4" <40) { div.id.Failed = "block"; div.Failed = "Failed"; } else { div.style.Passed = "block"; div.Passed = "show"; } } HTML Code: <div id="Fail" class="hidden" style="display: none"><b><i>You will need to Repeat the Semester!</b> <br /> </div> <div id="Passed" class="hidden" style="display: none"> <img src="faces.png" width="50" height="50"><b><i> "Good Job you passed the Semster!"</b></div> Code: <html> <head> <script type="text/javascript" src="jquery-1.6.1.min.js"></script> <script type="text/javascript"> function showonlyone(thechosenone) { var noticecontent = document.getElementsByTagName("div"); for(var x=1; x < noticecontent.length; x++) { name = noticecontent[x].getAttribute("name"); if (name == 'noticecontent') { if (noticecontent[x].id == thechosenone) { noticecontent[x].style.display = 'block'; } else { noticecontent[x].style.display = 'none'; } } } } </script> </head> <body> <center> <div id="parentdiv"> <div id="expandall">OPEN/CLOSE ALL</div> <div id="noticeheading1" class="noticeheading" name="noticeheading"; onClick="showonlyone('noticecontent1');">Heading 1</div> <div id="noticecontent1" name="noticecontent" class="noticecontent">awertysergyetwhwgertrhztrxdtykpopmift6hwe5awfwedaserhdy4hatefeshdgtrgd</div> <div id="noticeheading2" class="noticeheading" name="noticeheading"; onClick="showonlyone('noticecontent2');">Heading 2</div> <div id="noticecontent2" name="noticecontent" class="noticecontent">fh56serhgzsrxdtrjhgzsrltkjuytinubvre6io4exjhgftxtrokzet6ttawruthrthwru</div> <div id="noticeheading3" class="noticeheading" name="noticeheading"; onClick="showonlyone('noticecontent3');">Heading 3</div> <div id="noticecontent3" name="noticecontent" class="noticecontent">fdfjesrtaw5u4wgy5gw45use4syzerhgtawerfatrastaghgryseerathw5uz4de5ser5s</div> </div> </center> </body> </html> can anyone help on "OPEN/CLOSE ALL" to show or hide all .noticecontent divs this is what im trying to do: http://www.linkstraffic.net/programm...d/movebox.html using this code: http://www.linkstraffic.net/programm...nd/movediv.php heres my code. can someone fix it? html: [CODE] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Chris MacDonald - Javascript Assignment 2</title> <link href="styles/styles.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="java.js"></script> <div id="header"> <div id="logo"><img src="images/beat.png" /></div> </div> <ul id="nav"> <li><a href="#">Home</a></li> <li><a href="http://beatthreads.bigcartel.com/category/tees">Shirts</a></li> <li><a href="#">About Us</a></li> </ul> </head> <body> <div id="content"> <a href="#" onclick="interv=setInterval('ShowBox()',3);return false;">Upcoming Designs</a> <div id="coverlogin"> <div id="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus tristique cursus dui, a venenatis diam consectetur fermentum. Nulla facilisi. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Praesent aliquam ornare nunc non semper. Morbi blandit lectus non elit ultricies ultricies. Fusce mattis purus et eros ultrices et facilisis nulla consequat. Vestibulum tellus libero, tempor vel tincidunt nec, consectetur non ante. Donec sed malesuada felis. Mauris lorem lorem, ornare a rutrum quis, rutrum in mauris. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. <br/> <p align="left"><a href="#" onClick="interv=setInterval('HideBox()',3);return false;">X</a></p> </div> </div> </div> <div id="footer"> <div id="footertext">Beat Threads - 2010</div> </div> </body> </html> [CODE] javascript: // JavaScript Document var hh=0; var interv; //we show the box by setting the visibility of the element and incrementing the height smoothly function ShowBox() { //Depending on the amount of text, set the maximum height here in pixels if(hh==40) { clearInterval(interv); return; } obj = document.getElementById("coverlogin"); obj.style.visibility = 'visible'; hh+=2; obj.style.height = hh + 'px'; } function HideBox() { obj = document.getElementById("coverlogin"); if(hh==2) { obj.style.visibility = 'hidden'; obj.style.height = '0.1em'; clearInterval(interv); return; } hh-=2; obj.style.height = hh + 'px'; } [CODE] Can someone fix this for me? Hello, I have the folowing code but it seems to be broken between "SM Decision Support" and "Incident and Request Management". Does anyone know how I resolve ?. The idea is when somebody opens the page all the sections are hidden/uncollapsed and the user can collapse individually each section with a click or by hitting the expand/collapse all link. ------------ Have placed code in attachment as too long for this section Hi all, Check this code: PHP Code: <a>text</a> <div id="pkg">pkg</div> <div id="table_pkg">table_pkg</div> I'd like to show table_pkg and hide pkg when I click on <a>text</a>. How can I do? Thank you very much I don't know a lot about Javascript... still learning.. I am trying to create a show/hide effect that displays an image based on the users text input. I have coded this before for a list/menu and it works fine. With this particular project there are too many selections to choose from to put in a list/menu. I am trying to use if and else if statements to make this work. With the code the way it is only the first function on the list works. I tried just using repeating if statements and only the last function on the list works. Here is the code: Code: <script type="text/javascript" > function showSample() { if (document.getElementById('input').value='SW001') { document.getElementById('SW001').style.display='block'; document.getElementById('SW002').style.display='none'; document.getElementById('SW003').style.display='none'; document.getElementById('SW004').style.display='none'; } else if (document.getElementById('input').value='SW002') { document.getElementById('SW001').style.display='none'; document.getElementById('SW002').style.display='block'; document.getElementById('SW003').style.display='none'; document.getElementById('SW004').style.display='none'; } else if (document.getElementById('input').value='SW003') { document.getElementById('SW001').style.display='none'; document.getElementById('SW002').style.display='none'; document.getElementById('SW003').style.display='block'; document.getElementById('SW004').style.display='none'; } else if (document.getElementById('input').value='SW004') { document.getElementById('SW001').style.display='block'; document.getElementById('SW002').style.display='none'; document.getElementById('SW003').style.display='none'; document.getElementById('SW004').style.display='none'; } else if (document.getElementById('input').value='SW005') { document.getElementById('SW001').style.display='none'; document.getElementById('SW002').style.display='none'; document.getElementById('SW003').style.display='none'; document.getElementById('SW004').style.display='block'; } } </script> <style type="text/css"> <!-- #main { width: 400px; margin-right: auto; margin-left: auto; height: 125px; } #imageArea { float: right; width: 200px; } #formArea { float: left; width: 200px; height: 125px; } .image { height: 125px; width: 125px; margin-right: auto; margin-left: auto; display: none; } #SW001 { background: url(../_images/Colorfil/SW0001.jpg) no-repeat center center; } #SW002 { background: url(../_images/Colorfil/SW0002.jpg) no-repeat center center; } #SW003 { background: url(../_images/Colorfil/SW0003.jpg) no-repeat center center; } #SW004 { background: url(../_images/Colorfil/SW0004.jpg) no-repeat center center; } #SW005 { background: url(../_images/Colorfil/SW0005.jpg) no-repeat center center; } --> </style> </head> <body> <div id="main"> <div id="imageArea"> <div class="image" id="SW001"></div> <div class="image" id="SW002"></div> <div class="image" id="SW003"></div> <div class="image" id="SW004"></div> <div class="image" id="SW005"></div> </div> <div id="formArea"> <form action="" method="get"> <input type='text' name="input" id='input' /> <input name="" type="button" onclick="showSample(this.selectedIndex)"/> </form> </div> </div> </body> </html> Any help would be greatly appreciated! Im pretty new to JS so Im sure this is not the best way to go about this but it'll do for now, any suggestions welcome I have a script to show and hide various divs based on a function & var. The problem im having is that when ANY of the variables ('hate', 'ok' and 'love') are passed all 3 different feedback forms ('FeedbackHate', 'FeedbackOk' and 'FeedbackLove') appear, not just the one I want. here is the JS: Code: function sitesurveyswitch(emotion) { var e = emotion; document.getElementById('site_survey_hate').style.backgroundPosition = '0px 0px'; document.getElementById('site_survey_ok').style.backgroundPosition = '0px 0px'; document.getElementById('site_survey_love').style.backgroundPosition = '0px 0px'; document.getElementById('FeedbackHate').style.display = 'none'; document.getElementById('FeedbackOk').style.display = 'none'; document.getElementById('FeedbackLove').style.display = 'none'; if (e == 'hate') document.getElementById('site_survey_hate').style.backgroundPosition = '-80px 0px'; document.getElementById('FeedbackHate').style.display = 'block'; if (e == 'ok') document.getElementById('site_survey_ok').style.backgroundPosition = '-80px 0px'; document.getElementById('FeedbackOk').style.display = 'block'; if (e == 'love') document.getElementById('site_survey_love').style.backgroundPosition = '-80px 0px'; document.getElementById('FeedbackLove').style.display = 'block'; } and here is the code related to this function: Code: <div id="siteSurveyBox"> <span id="site_survey_hate" onclick="sitesurveyswitch('hate');return false;"></span> <span id="site_survey_ok" onclick="sitesurveyswitch('ok');return false;"></span> <span id="site_survey_love" onclick="sitesurveyswitch('love');return false;"></span> </div> <div id="FeedbackHate" style="display:none; margin-top:-28px;"> FEEDBACK FORM IS HERE </div> <div id="FeedbackOk" style="display:none; margin-top:-28px;"> FEEDBACK FORM IS HERE </div> <div id="FeedbackLove" style="display:none; margin-top:-28px;"> FEEDBACK FORM IS HERE </div> Hi guys, im new to forums and need some help with my website. I have embed a flash player known as: JW player into my website and put it into a div. Now my problem is I want javascript to hide the div containing the flash player for atleast a few seconds to display a loading image.gif. How would I set this up? Im not to familiar about using javascript so im not sure if its even possible. Anways thx for any help ore suggestions related to this subject. Hello, I'm trying to have a div be hidden on loading the page but when you click a link it will show the div... here's code I have but it doesn't show when you click the link... <script type="text/javascript"> function show(){ document.getElementById(test).style.display="block"; } </script> <div id="test" style="display:none;"> <p>Some text</p> </div> <a href="#" onclick="show(); return false;">Show</a> I'm creating a website where I would like to create some kind of tabbed pages. To do that I wrote a javascript where I create an array of all the divs I use to create the pages and then sets them all on style="display: none;" except the one I clicked which should get style="display: block;" But I can't seem to get it to work... This is the script itself: Code: var state = 'none'; var i; var divs = new Array(); divs[0] = document.getElementById(div1); divs[1] = document.getElementById(div2); divs[2] = document.getElementById(div3); divs[3] = document.getElementById(div4); divs[4] = document.getElementById(div5); function showhide(layer_ref) { divs[0].innerHTML="some contents"; for (i=0;i<divs.length;i++) { if(divs[i] == document.getElementById(layer_ref)) { state = 'block'; } else { state = 'none'; } if (document.all) { //IS IE 4 or 5 (or 6 beta) eval( "document.all." + divs[i] + ".style.display = state"); } if (document.layers) { //IS NETSCAPE 4 or below document.layers[divs[i]].display = state; } if (document.getElementById &&!document.all) { hza = document.getElementById(divs[i]); hza.style.display = state; } } } And this is part of the html of the page: Code: <head> <script type="text/javascript" src="scriptShowHide.js"></script> </head> <div id="navigation"> <ul class="tabContainer2"> <li><a class="orange" href="#" onclick="showhide('div1');">Tab1</a></li> <li><a class="orange" href="#" onclick="showhide('div2');">Tab2</a></li> <li><a class="orange" href="#" onclick="showhide('div3');">Tab3</a></li> <li><a class="orange" href="#" onclick="showhide('div4');">Tab4</a></li> <li><a class="orange" href="#" onclick="showhide('div5');">Tab5</a></li> </ul> </div> <div id="div1" style="display: block;">This is the content of tab1</div> <div id="div2" style="display: none;">This is the content of tab2</div> <div id="div3" style="display: none;">This is the content of tab3</div> <div id="div4" style="display: none;">This is the content of tab4</div> <div id="div5" style="display: none;">This is the content of tab5</div> Can anyone help me plz, I've been staring at this for hours... I have a script that is to hide specific divs and show the one called, or at least that is what I would like to happen. Right now when I click the link to show my div it hides my entire page and display the item in quetion. When I parse the return from document.getelementbytagname('div') it shows that I have 8 elements on my page. Great, but I only want to turn off the ones that match the following reg exp: "/^F\d+$/" the rest of the page I want to be left in tact. So far the rabbit trail that I am going down is working out so great, can you advise a script that will let me hide all div elements that match a specific pattern: /^F\d+$/ I have two samples that I am working from. The first: Code: <script language=javascript type='text/javascript'> function showDiv(pass) { var divs = document.getElementsByTagName('div'); alert(divs.length); var regExp = "/^F\d+$/"; for(i=0; i<divs.length; i++){// var obj = document.getElementsById(pass).item(i); if (obj){ var divIdName = obj.id; alert(divIdName); } //myregexp = /regex/ alert(i); if(divs[i].id.match(pass))//if they are 'see' divs { alert(divs[i].id.value); if (document.getElementById) // DOM3 = IE5, NS6 divs[i].style.visibility="visible";// show/hide else if (document.layers) // Netscape 4 document.layers[divs[i]].display = 'visible'; else // IE 4 document.all.divs[i].visibility = 'visible'; } else if (!divIdName.match(pass) && document.getElementById()== regExp){ if (document.getElementById) divs[i].style.visibility="hidden"; else if (document.layers) // Netscape 4 document.divs[i].visibility = 'hidden'; else // IE 4 document.all.divs[i].visibility = 'hidden'; } else { } } } //end function </script> The second example is closer to what I want to do, but I haven't been able to figure out how to dynamically load the array "var ids=new Array();" so that I can automate the script. The code for this page: Code: <script language="JavaScript"> //here you place the ids of every element you want. //var ids=new Array('F256','F257','F258','F259');// etc... var divs; // = document.getElementsByTagName('div'); var obj; var divIdName; var ids=new Array(); function switchid(id){ divs = document.getElementsByTagName('div'); for(i=0;i<divs.length;i++){// obj = document.getElementsByName(id).item(i); divIdName = obj.id; alert(divIdName); if(divIdName.match(/^F\d+$/)) { ids[i] = divIdName; } alert(divs.length); } hideallids(); showdiv(id); } function hideallids(){ //loop through the array and hide each element by id for (var i=0;i<ids.length;i++){ hidediv(ids[i]); } } function hidediv(id) { //safe function to hide an element with a specified id if (document.getElementById) { // DOM3 = IE5, NS6 document.getElementById(id).style.display = 'none'; } else { if (document.layers) { // Netscape 4 document.id.display = 'none'; } else { // IE 4 document.all.id.style.display = 'none'; } } } function showdiv(id) { //safe function to show an element with a specified id if (document.getElementById) { // DOM3 = IE5, NS6 document.getElementById(id).style.display = 'block'; } else { if (document.layers) { // Netscape 4 document.id.display = 'block'; } else { // IE 4 document.all.id.style.display = 'block'; } } } </script> </head> <body> <div id="test" class="jobTitle_and_descriptionParent"> <div id="test1" class="jobListTitles"> <h5>Click one of the job titles to reveal the description on the right</h5> <ol> <li><a href="javascript:switchid('F256');">Breakfast Club Coordinator</a></li> <li><a href="javascript:switchid('F257');">Bible Teacher</a></li> <li><a href="javascript:switchid('F258');">Registration Coordinator</a></li> <li><a href="javascript:switchid('F259');">Staff</a></li> <li><a href="javascript:switchid('F260');">Assistant Counselor</a></li> <li><a href="javascript:switchid('F261');">Drama Coordinator</a></li> <li><a href="javascript:switchid('F262');">Special Services Assistant</a></li> <li><a href="javascript:showDiv('F263')">Deans</a></li> <li><a href="javascript:showDiv('F264')">Registration Workers</a></li> <li><a href="javascript:showDiv('F265')">Counselors</a></li> <li><a href="javascript:showDiv('F266')">Drama & Breakfast Club Assistants</a></li> <li><a href="javascript:showDiv('F267')">Aunt & Uncle</a></li> <li><a href="javascript:showDiv('F268')">Placement Coordinator</a></li> <li><a href="javascript:showDiv('F269')">Activity Center Person</a></li> <li><a href="javascript:showDiv('F270')">Social Worker/Psychologist</a></li> </ol> </div> <div id='test3' class="jobDescriptions"> <div id="F256" name="F256" style="position: inherit; visibility:hidden;"> f256 Here </div> <div id="F257" name="F257" style="position: inherit;visibility:hidden;"> f257 Here </div> <div id="F258" name="F258" style="position: inherit;visibility:hidden;"> f258 Here </div> <div id="F259" name="F259" style="position: inherit;visibility:hidden;"> f259 Here </div> <div id="F260" name="F260" style="position: inherit;"> f260 Here </div> </div> </div> Been struggling with this for a couple days now and just not making any headway. Could you advise? Kevin |