| | |
Bold text for selected item collapsible panel
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Hey all,
I have a very simple collapsible panel which is working fine right now, but I am trying to make the expanded item's text bold "Without doing a post back or use of links". Here is the code:
Any help would be much appreciated.
Thanks,
Pete
I have a very simple collapsible panel which is working fine right now, but I am trying to make the expanded item's text bold "Without doing a post back or use of links". Here is the code:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Collapsible Panel Test</title> </head> <script language="jscript"> sel = '' function show_section(section_id) { if (sel != '') { ds = document.getElementById(sel) ds.style.display = "none" } sel = 'PanelDetails_' + section_id dt = document.getElementById(sel) dt.style.display = "" } </script> </head> <body class="body"> <b><span id="ctlPageTitle">Collapsible Panel Test</span></b><br /> <br /> <span id="ctlItemSelection"> <ul class="submenu2"> <li class="selected"> <span onclick="show_section(1)" onmouseover="style.cursor='hand'">Item 1</span> </li> <div id="PanelDetails_1" style="display:none"> <blockquote> Detail Description for item 1. </blockquote> </div> <li> <span onclick="show_section(2)" onmouseover="style.cursor='hand'">Item 2</span> </li> <div id="PanelDetails_2" style="display:none"> <blockquote> Detail description for item 2. </blockquote> </div> </ul> </body> </html>
Any help would be much appreciated.
Thanks,
Pete
You may try this code, i've done a lite modification over you script. Hope you find it useful...
javascript Syntax (Toggle Plain Text)
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Collapsible Panel Test</title> <style type="text/css"> <!-- body { font: 70%/1.5em Arial, sans-serif; color: #696969; text-align: left; } h3 { font: 700 16px Arial; color: #181818; } ul { list-style-type: none; margin: 10px 0 0 5px; } li { font: 500 13px Arial; color: MidnightBlue; padding: 3px 0 15px 0; } li.selected { font: 700 13px Arial; color: Orange; } blockquote { margin: 0 0 5px; padding: 7px; font: 900 15px Georgia, "Times New Roman", Times, serif; width: 200px; height: auto; border-style: dashed; border-width: 1px; border-size: 2px; border-color: white; background-color: #000; color: white; text-align: left; letter-spacing: 3px; } .hide { display: none; } .show { display: normal; } --> </style> <script type="text/javascript"> <!-- function toggle() { items = document.getElementsByTagName('ul')[0].getElementsByTagName('li'); details = document.getElementsByTagName('ul')[0].getElementsByTagName('blockquote'); for (var i = 0; i <= items.length; i++) { items[i].onclick = function() { for (var x = 0; x <= items.length; x++) { if ( items[x].className == 'selected' ) { items[x].className = ''; } this.className = 'selected'; if ( details[x].className == 'show' ) { details[x].className = 'hide'; } if ( items[0].className == 'selected' ) { details[0].className = 'show'; } else if ( items[1].className == 'selected' ) { details[1].className = 'show'; } else { details[2].className = 'show'; } } } } } window.onload = toggle; //--> </script> </head> </head> <body> <h3>Collapsible Panel Test</h3> <ul> <li> Item 1 </li> <blockquote class="hide"> Detail Description for item 1. </blockquote> <li>Item 2 </li> <blockquote class="hide"> Detail description for item 2. </blockquote> <li>Item 3 </li> <blockquote class="hide"> Detail description for item 3. </blockquote> </ul> </body> </html>
Last edited by essential; Nov 17th, 2008 at 3:36 am.
![]() |
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Binary to Decimal Converter
- Next Thread: tooltip style popup
| Thread Tools | Search this Thread |
acid2 ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate array automatically beta box browser bug calendar captchaformproblem cart close codes column cookies css date debugger decimal dependent design disablefirebug dom download element embed engine enter error events ext file firefox focus form frameworks getselection google gwt gxt hiddenvalue highlightedword hint html htmlform ie7 iframe index java javascript javascripthelp2020 jawascriptruntimeerror jquery jsp libcurl listbox maps masterpage media menu microsoft mimic mp4 onmouseoutdivproblem onmouseover paypal pdf php player position post problem programming prototype redirect regex safari scale scriptlets scroll search security select software sql text textarea toggle unicode variables w3c website window windowofwords windowsxp





