[haXe] Another haxeJs newbie question
Axel Huizinga
axel at 3drachen.de
Fri Dec 7 13:29:03 CET 2007
Hi Franco,
> I've tested your code and it works for me (FF and IE) ... I've just
> made some oreder ...
>
> import js.Dom;
>
> class Example {
> public static function main() {
> var sheets = js.Lib.document.styleSheets ;
> if(sheets!=null)for(i in 0...sheets.length) {
> var sheet = sheets[i];
> var rules : Array<Dynamic> = untyped sheet.cssRules != null ?
> sheet.cssRules : sheet.rules;
> for(j in 0...rules.length) {
> var rule = rules[j];
> if(rule.selectorText == ".menuItem") {
> rule.style.color = "#FFFFFF";
> rule.style.backgroundColor = "#FF0000";
> rule.style.fontSize = "0.8em";
> rule.style.padding = "4px";
> }
> }
> }
> }
> }
>
>
yes it works - I forgot to comment out another part of my code which
made direct style assignments
But I found another oddity:
node.getAttribute('href') returns null on mozilla and '' (empty String)
on IE (6).
so I have to compare twice if I want to test if the attribute is set?
Axel
More information about the Haxe
mailing list