From: DuncanIdaho on
Hello

IE 7.0.5730.11
Opera 9.27
Firefox 2.0.0.14

I have the following in my stylesheet

..navbody a{
text-decoration: none;
color: rgb(68, 146, 181);
}

a.leaf{
text-decoration: none;
color: rgb(254, 100, 253);
font-size: 0.75em;
}

AJAX produces the following html

<div id="navmenu">
<div id="menuheader">
Browse Catagories
<br/>
<a href="javascript:getMenuUpdate('-1')">collapse menu</a>
</div>
<div id="menudiv" class="navbody">
<span>
<a href="javascript:getMenuUpdate('1')">
</a>
<a class="node" href="javascript:getMenuUpdate('1')">Jewellery</a>
</span>
<br/>
<span>
<img border="0" src="images/navspacer.jpg"/>
<a class="leaf" href="products?catagoryId=1:1">Earrings</a>
</span>
.... etc

in Opera and Firefox the anchor with class 'leaf' is rendered in a
smaller pink font (nice!) in IE it's rendered in the same sized light
blue as other stuff in the navbody

Are class selectors supposed to work when output is dynamically
generated ? or is this another 'feature' of IE

TIA

Idaho
From: Steve Pugh on
On Apr 23, 2:12 pm, DuncanIdaho <Duncan.Idaho2...(a)googlemail.com>
wrote:

> I have the following in my stylesheet
>
> .navbody a{
>         text-decoration: none;
>         color: rgb(68, 146, 181);
> }
>
> a.leaf{
>         text-decoration: none;
>         color: rgb(254, 100, 253);
>         font-size: 0.75em;
> }
>
> AJAX produces the following html
[snip]

> in Opera and Firefox the anchor with class 'leaf' is rendered in a
> smaller pink font (nice!) in IE it's rendered in the same sized light
> blue as other stuff in the navbody
>
> Are class selectors supposed to work when output is dynamically
> generated ? or is this another 'feature' of IE

Known problem with IE when elements are added to the DOM via scripting
(the fact that the content was fetched via AJAX is irrelevant, you can
see the same issue when adding it locally). You need to apply the
class via the className property _after_ the element has been inserted
into the DOM. I used to know the reason for this but it's slipped my
mind (must be getting old). Ask in an IE or JavaScript related group
for more details.

Steve