macromedia.coldfusion.cfml_general_discussion
[Top] [All Lists]

Simple Javascript rows change

Subject: Simple Javascript rows change
From: "ism"
Date: Thu, 1 Jan 2009 07:28:16 +0000 UTC
Newsgroups: macromedia.coldfusion.cfml_general_discussion

Hi all-

 I am trying to switch the row color of the clicked cell and tuen off the one 
that is not clicked:

 <script type="text/javascript"> 
     var extra1 = 'off';

     function toggleExtra1(s,c) 
     {
         if(c== 'OffCels') 
         { 
             extra1 = 'on'; 
                        eval(s).className='OnCels';
         } 
         else 
         { 
                        eval(s).className='OffCels';
                         extra1 = 'off'; 
         } 
                var extra1 = 'off';
     } 
            
        </script>

   <tr>
     <td class="OffCels" id="r1" 
onClick="toggleExtra1(this,this.className);">1</td>
   </tr>
   <tr>
     <td class="OffCels" id="r2" 
onClick="toggleExtra1(this,this.className);">2</td>
   </tr>
 </table>

 Not sure why this is not working. It turns both on. thanks for help.

 ISM



<Prev in Thread] Current Thread [Next in Thread>