Advanced Search

Results 1 to 2 of 2

Thread: adding tab heading highlight to script

  1. #1
    Join Date
    May 2006
    Posts
    98
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Default adding tab heading highlight to script

    Switch Content Script II (icon based)

    http://www.dynamicdrive.com/dynamici...chcontent2.htm

    Hi, This is not a problem but a query. I was wondering if an enhancement to this script were possible. Could the title of each content heading like
    "What is JavaScript?" be highlighted when it is expanded? I have them as links
    <a class="mena" href="/" title="">What is JavaScript?" </a>
    so I was wondering if one could switch a classes when expanded.
    Its just a thought


    Code:
    <div class="eg-bar"><span id="faq1-title" class="iconspan"><img src="minus.gif" /></span>What is JavaScript?</div>
    Thanks
    Richard

  2. #2
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    Yes...it's possible

    Add this script in the head section:
    Code:
    <script type="text/javascript">
    window.onload = function()
    {
    	var obj=document.body.getElementsByTagName('div');
    	for(var start=0;start<obj.length;start++)
    		{
    		obj[start].onclick=function() 
    			{
    			this.className = (this.className != 'eg-bar')? 'eg-bar': 'rangeg-bar';
    			}
    		}
    }
    </script>
    ...Then include this code in your CSS rule
    Code:
    .rangeg-bar
    {background:#9cf;width:500px;
    font-weight: bold;
    border: 1px solid black;
    padding: 3px;}
    See if it helps
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  3. The Following User Says Thank You to rangana For This Useful Post:

    rich1234 (04-26-2008)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •