[Dojo-interest] Set CSS class

Tom Trenka dinterest at dept-z.com
Mon Dec 17 15:46:37 UTC 2007


"class" and "style" are not real attributes, which is why you can't set them
that way in IE.  To set the class on a node, do this:

node.className="Foo";

for style text:

node.cssText="styletexthere";

trt


Daniel Carrera-2 wrote:
> 
> Thanks.
> 
> Sigh...  Some times IE makes me want to cry. I've been trying to get the 
> stupid thing to work for hours. The IE debugger *says* that the object 
> has the class "Foo", but visually it doesn't have any of the attributes 
> of the class (background, text-alignment, box size) and the result is 
> quite unusable (because the box is tiny and it's supposed to be big).
> 
> I don't know what to do anymore. IE only seems to read the CSS when it's 
> not a class that was added later by me. And I really really can't 
> refactor the CSS in a way that doesn't require assigning a class to the 
> div in question.
> 
> I was hoping that Dojo's addClass function would work because Dojo 
> widgets don't seem to have this problem. But it didn't help. :-(
> 
> I'll come back to this tomorrow.
> 
> Thanks for the help.
> 
> Daniel.
> 
> 
> Dustin Machi wrote:
>> http://redesign.dojotoolkit.org/?q=jsdoc/dojo/HEAD/object/dojo.addClass
>> 
>> Daniel wrote:
>>> Hello,
>>>
>>> I'm having trouble with Internet Explorer. It doesn't like this
>>> construct:
>>>
>>> domObj.setAttribute("class", "Foo");
>>>
>>> I believe that there is a dojo method to assign a class to an DOM 
>>> object, but I've been looking all over for it and can't find it. Could 
>>> someone tell me how to assign a class to an object? On Google I found 
>>> 'dojo.html.setClass' but apparently that doesn't exist anymore.
>>>
>>> Help.
>>>
>>> Daniel.
>>> _______________________________________________
>>> FAQ: http://dojotoolkit.org/support/faq
>>> Book: http://dojotoolkit.org/docs/book
>>> Forums: http://dojotoolkit.org/forum
>>> Dojo-interest at dojotoolkit.org
>>> http://dojotoolkit.org/mailman/listinfo/dojo-interest
>>>
>> 
>> _______________________________________________
>> FAQ: http://dojotoolkit.org/support/faq
>> Book: http://dojotoolkit.org/docs/book
>> Forums: http://dojotoolkit.org/forum
>> Dojo-interest at dojotoolkit.org
>> http://dojotoolkit.org/mailman/listinfo/dojo-interest
>> 
> 
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://dojotoolkit.org/docs/book
> Forums: http://dojotoolkit.org/forum
> Dojo-interest at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-interest
> 
> 

-- 
View this message in context: http://www.nabble.com/Set-CSS-class-tp14367310p14372558.html
Sent from the Dojo mailing list archive at Nabble.com.



More information about the Dojo-interest mailing list