Link to home
Create AccountLog in
Avatar of vielkacarolina1239
vielkacarolina1239Flag for United States of America

asked on

how to get the style attributes from a style object returned by getAttribute() in javaScrpt mehtod?

Hi,

I am using ASP.NET and javaScript

I a firing the event, onmouseover(), when the mouse hoovers a span element. This event calls  moueOverText() method. moueOverText() method is passed the this object of the span element.

how can I reference the style attributes (color, text-align, font, height)

please, show me the code.

Thanks



function moueOverText(theThis)
{
   var elemStyle = theThis.getAttribute("style");
   if(elemStyle)
   {
       //how do I reference the content of the elemStyle object
   }
}
 
.
.
...
 
<span style="color:#e1e1e1; text-align:left; font:Verdana; height:23px;" onmouseover="moueOverText(this)">
   how to reference the style content using getAttribute() in javaScript
</span>

Open in new window

SOLUTION
Avatar of Roonaan
Roonaan
Flag of Netherlands image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
ASKER CERTIFIED SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
var elemStyle = theThis.getAttribute("style");
   if(elemStyle)
   {
       theThis.setAttribute("style",value);
   }