WebFX WebBoard
Message Thread:
View All Messages
Back to WebFX
 Need help, changing style classes with JavaScript, Guillermo, September 4, 2003
     Re:Need help, changing style classes with JavaScript, Guillermo, September 15, 2003
         Re:Need help, changing style classes with JavaScript, Erik Arvidsson, September 15, 2003
             Re:Need help, changing style classes with JavaScript, Guillermo, September 17, 2003

Subject: Need help, changing style classes with JavaScript From: Guillermo Date: September 4, 2003

It's me again, with some new problems that need attention.

Go to http://cdbaires.com/sitio/Home.asp . You'll see that there is a table with the text: "Nombre del titulo". When you click on it, another table directly below is shown, and at the same time the style class for the first table is changed in order to chang it's color to match the table below.

What I need to do now is this:

When the user click the checkbox at the rigth, both tables have to change it's color to a light green. I already have this class defined.

This is what I used for the first function (show the table, chang the class of the first table):

function toggleDesc(ID) {
 
 if( document.getElementById("tblDesc"+ID).style.display == "block" ) {
    document.getElementById("tblDesc"+ID).style.display = "none";
 document.getElementById("tblTit"+ID).className = 'FilaTituloOff';
  } else {
    document.getElementById("tblDesc"+ID).style.display = "block";
 document.getElementById("tblTit"+ID).className = 'FilaTituloOn';
  }
}

The three states (classes) are:

FilaTituloOff  > White background, 1px green bottom border.
FilaTituloOn  > Grey background, no border
FilaTituloSelect > Light green background.

Now here's the tricky part: As you can see, you can check the checkbox with the description table shown or hidden, and that makes the style selection a bit more complicated. The function should detect wich style is applied to the first table (FilaTituloOff or FilaTituloOn) and apply the new (Select) class. For example, if I check the item without first displaying it's description (2nd table) the script would have to change the class to a light green WITH a green bottom border to the first table. However, if before selecting the item I display it's description (hidden 2nd table), the script should now apply a different style (green background, NO bottom border) because otherwise I would have two green borders, wich I do not want.

 




Reply
Name: 
Email: 
Subject: 

Enter your reply to this message below. HTML tags are not supported but words that start with http://, ftp:// or mailto: are converted to links.


View All Messages
Back to WebFX