I need to have dynamic tab color

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ganfun
    New Member
    • Jan 2007
    • 1

    I need to have dynamic tab color

    i have a special problem in the project.

    i have a page with tabs, the tabs are done in html pages and no images are used.

    here is the code what i am doing :

    [HTML]<table border="0" cellpadding="0" cellspacing="0" width="42%" id="table3">
    <br>
    <tr> <!-- #014F96 -->

    <script>alert(d ocument.write(' bag'));</script>
    <td align="center" bgcolor="docume nt.write(bag)"w idth="25%"><b>< font face="Verdana">
    <a class="lnk" href="Javascrip t: shInstructions( 1);">
    <font color="#FFFFFF" size="2">Qualif ication</font></a></font></b></td>
    <td align="center" width="1%">&nbs p;</td>
    <td align="center" style="border: 1px solid #014F96; padding: 0" width="25%">
    <font face="Verdana" size="2">
    <a href="Javascrip t: shInstructions( 2);">Experience </a></font></td>
    <td align="center" width="1%">&nbs p;</td>
    <td align="center" width="30%" style="border: 1px solid #014F96; padding: 0">
    <font face="Verdana" size="2">
    <a href="Javascrip t: shInstructions( 3);">Family Details</a></font></td>
    </tr>
    </table>
    [/HTML]
    i am calling a function shinstruction which does hiding of tables below.

    now when a user clicks the next tab the bg color has to change and the tab from where he moves has to come to the original color.

    How do i do this ?? Using javascript.

    I checked with document .write(bg) --> this was a variable that i was passing from the javascript below :

    Code:
    <script language="javascript">
    	function shInstructions(gg)
    	{		
    		
    		if (gg==1)
    		{
    		
    		if (window.qual.style.display == "none")
    			
    			window.qual.style.display = ""					
    		else
    			window.qual.style.display = ""
    			window.exp.style.display = "none"
    			window.family.style.display = "none"
    			var bag="white"
    			
    		}		
    		if (gg==2)
    		{
    		if (window.exp.style.display == "")
    			window.exp.style.display = ""
    			
    
    		else			
    			window.qual.style.display = "none"
    			window.exp.style.display = ""
    			window.family.style.display = "none"
    			
    			
    
    		}
    		if (gg==3)
    		{
    		if (window.family.style.display == "")
    			window.family.style.display = ""
    			
    
    		else			
    			window.qual.style.display = "none"
    			window.exp.style.display = "none"
    			window.family.style.display = ""
    			
    		}
    		
    	}
    </script>
    Pls help & suggest.
    Last edited by acoder; Jan 25 '07, 03:24 PM. Reason: Code in tags (edited to display properly)
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    document.write( ) doesn't work like that.

    Use the style.backgroundColor property to change the background color.

    Comment

    Working...