Not sure about expected behavior, but the CSS version certainly seems
more correct to me. It could be shortened to:

$(".pics").css({borderStyle:"solid", borderWidth:"1px", borderColor:"white"});

Or really, in that specific case:

$(".pics").css("border", "1px solid white");

If you find yourself adding (and especially removing) specific styling
a lot, you might be better off to make a class and style the class:

.whiteBorder {
 border: 1px solid white;
}

$(".pics").addClass("whiteBorder");

Also, when using class based selectors, it performs better to specify
a tag too. Like:

$("div.pics")...

Or maybe this was just a trivial example to illustrate an
inconsistency, in which case, ignore me. Either way, file a bug report
for it so it doesn't get lost. Inconsistent behavior is no good, but
.attr('style', ...) is certainly best to avoid. I think that's the
whole point of .css(...).

--Erik


On 5/9/07, Bil Corry <[EMAIL PROTECTED]> wrote:

In IE7, this doesn't work on an <img> element (and possibly others, didn't test 
it):

        $(".pics").attr("style","border-style: solid; border-width: 1px; 
border-color: white;");

But this does work for IE7:

        
$(".pics").css("border-style","solid").css("border-width","1px").css("border-color","white");

Both work in FF2.  Is that the expected behavior in IE7?

I have an example written up both ways to illustrate.  Select one of the small 
images, its border should change to white:

You can see the working version here:

        <http://www.corry.biz/phototest/>

And the non-working version here (requires IE7):

        <http://www.corry.biz/phototest/phototest2.lasso>



- Bil



Reply via email to