Contact Doug!
Learn About Doug!
View Doug Boude's online resume
updated 11/18/2009

View Doug Boude's profile on LinkedIn
Link to me!

Follow Doug Boude on Twitter
Follow me!

Be Doug's friend on Facebook
Befriend me!
(I promise not to follow you home)
OO Lexicon
Chat with Doug!
Recent Entries
You may also be interested in...
Florida web site design



Czech your Page Rank!
Check Page Rank of any web site pages instantly:
This free page rank checking tool is powered by Page Rank Checker service
Surf's Up!
Visit Egosurf.org and massage YOUR web ego!
My Score: 9,001
Doug's Books

Read (and recommend)

  • Men are from Mars, Women are from Venus
  • The Wisdom of Crowds: Why the Many Are Smarter Than the Few and How Collective Wisdom Shapes Business, Economies, Societies and Nations
  • Blink: The Power of Thinking Without Thinking
  • Head First Design Patterns
  • Transact-SQL Programming
  • What's So Amazing About Grace?
  • Just So Stories (Rudyard Kipling collection)

Reading

  • Prayer: Does it Make Any Difference?
  • Data Mining (Practical Machine Learning Tools and Techniques)
<< July, 2007 >>
SMTWTFS
1234567
891011121314
15161718192021
22232425262728
293031
Search Blog

Recent Comments
Categories
Archives
Photo Albums
Funnies (5)
Family (3)
RSS

Powered by
BlogCFM v1.11

14 May 2008
Inline CSS and Ajax Issue with IE
IE Got Me Again
After spending more time than I care to say troubleshooting a CSS issue with IE7, I thought I'd share the details here in case it saves anybody else some time later down the road.

The Scenario...
I have an application that updates the contents of one of its divs using an ajax call that returns html. Within that retrieved html is a style block (<style>...</style>) defining how I want my table headers (<th>...also contained within the retrieved html) to appear.

IN A NUTSHELL: IE7 does not recognize inline styles that were retrieved via an ajax call.

Perhaps this is a "duh" item to some of you who already knew it, but since my beloved FIREFOX accepted them just fine, it didn't occur to me until I had tried every other possible iteration and syntax to move the styles out of my retrieved html and into my app's global CSS template, which (by the way), is the solution to this issue.

Hope this saves someone else some time and emotional pain.



Posted by dougboude at 11:00 AM | PRINT THIS POST! |Link | 9 comments
Subscription Options

You are not logged in, so your subscription status for this entry is unknown. You can login or register here.

Re: Inline CSS and Ajax Issue with IE
This seems like a crazy bug to me. I am surprised that this happens. Why can't everything be a bit more like FireFox :)
Posted by Ben Nadel on May 14, 2008 at 11:50 AM

Re: Inline CSS and Ajax Issue with IE
Oh My God! Thank YOU!!! I can't believe I found this little bit of info - which has indeed saved me hours of futile cursing at IE and the 2 brain-celled idiots that work there.

Many thanks for the tip :-)
Posted by whimZefx on May 18, 2008 at 7:09 AM

Re: Inline CSS and Ajax Issue with IE
Glad it saved someone else some headache and hair pulling, WhimZefx. :) That's EXACTLY why we should all share the things we learn. ;)
Posted by dougboude on May 18, 2008 at 3:34 PM

Re: Inline CSS and Ajax Issue with IE
If you are creating elements via the DOM, the CSS class attribute must be specified with JavaScript; IE 7 doesn't validate or re-parse any .setAttribute calls

element.className = 'SomeCssClasDeclaredInTheGlobalStyleSheet';
Posted by xdor on December 3, 2008 at 2:06 PM

Re: Inline CSS and Ajax Issue with IE
Thanks, Doug!

Just wanted to verify that the same issue is in place for IE6. Adding all the style information AND links to external stylesheets OUTSIDE of the area with the code being replaced fixed things up just fine.
Posted by cc on April 3, 2009 at 1:48 PM

Re: Inline CSS and Ajax Issue with IE
hi,

it seems to me that Firefox3 is not applying inline css anymore?

Some code that worked now is not in FF... all I do is to
Posted by Cris Rus on May 15, 2009 at 6:54 AM

Re: Inline CSS and Ajax Issue with IE
I have added the style in GLOBAL CSS but still not able to get the effect of dat Style in I.E. but where in firefox it is working fine....
If my WebPage is normal page (Page not called from Ajax) then CSS is working Fine in I.E. but as soon as dat page from Ajax the effect from CSS is negligible.

IN firefox it is working fine but not in I.E.
Posted by sachin on January 5, 2010 at 6:38 AM

Re: Inline CSS and Ajax Issue with IE
@sachin - yeah, retrieving html content that contains its own css when in IE...IE ignores the css. You have to put those styles outside the ajax call, in the container page in order for the css to be applied to html retrieved via ajax in IE. Just a weird bug I discovered a while back.
Posted by dougboude on January 5, 2010 at 8:56 AM

Re: Inline CSS and Ajax Issue with IE
Thanks for ur prompt reply.

There is no style in the file which is called from ajax.I am using only one file that is Global CSS.And from ajax file only simple html and updated information from server is coming.So no style is coming from Ajax.Let me send you the url where u can check.

http://www.newmiamiarch.org/ip.asp?op=Events_ShowAll_Masses .When u will navigate this ,then u will see on calendar on the right hand side.Please click on the small pics in the caledar then ajax function will call and u will see the difference in FONTS and the colour of the heading and title is everthing is same except the FONTS.

And also click on the right hand side the list of events to check the difference between the navigation through calendar on the right hand side and the list of events below the calendar.This difference is only in I.E.I think CSS is working coz the colour of the heading and title is same,only fonts differ.And for the fonts i am using below class

.styledefault{
font-family:Georgia,Times New Roman,Times, serif;
font-size:12px;
color:#7e7d7d;
line-height:16px;
}

Thanks,
Sachin
Posted by sachin on January 11, 2010 at 1:12 AM

Name:   Required
Email:   Required your email address will not be publicly displayed.

Want to receive notifications when new comments are added? Login/Register for an account.

Time to take the Turing Test!!!

15 plus 5 equals
Type in the answer to the question you see above:

Your comment:

Sorry, no HTML allowed!