0

I am calling the below function on the click of an 'OK' button to set the attribute of a cell of a table (attributes for <td> tag), however i am not able to set the 'style' attribute of the <td> tag with the code below. Please help me in achieving this.

function Ok()
{
variable ="FILTER:progid : DXImageTransform.Microsoft.gradient (GradientType=1, startColorstr="+GetE('txtColor1').value+", endColorstr="+GetE('txtColor2').value+"); HEIGHT:"+GetE('txtHeight').value+"px";  //setting the value of style attribute   
   for( i = 0 ; i < aCells.length ; i++ )
   {
       SetAttribute( aCells[i], 'borderColor'   , GetE('txtBorderColor').value ) ;
      SetAttribute( aCells[i], 'style'      , variable ) ; //not working
   }

   return true ;
}

The above code is to apply gradient color to the cell of a table.

2
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by essential
0
{ SetAttribute( aCells[i], 'borderColor', GetE ('txtBorderColor').value ) ;
SetAttribute( aCells[i], 'style', variable ) ; //not working
} return true ;
}

it should besetAttribute() not SetAttribute()

0

it should besetAttribute() not SetAttribute()

I tried setAttribute(), it does not work and throws up an error saying object expected. SetAttribute() for other attributes works fine, but for 'style' attribute it does not work.

0

If you wil try my suggestion -- then the best reliable way to apply gradient colors to your cells is to use a simple mathematical equation with javascript.
Ok, as we go back to the "setAttribute" issue -- let's try this one 1st:

for( i = 0 ; i < aCells.length ; i++ )
{ aCells[i].setAttribute('borderColor', GetE ('txtBorderColor').value );
aCells[i].setAttribute('style', variable);
} //I havnt test your code, but i hope this can help.
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.