Click here to get back home

how to style an AJAX-loaded fragment

 HomeNewsGroups | Search

comp.infosystems.www.authoring.html - discuss HTML authoring here 

get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
how to style an AJAX-loaded fragment lcplben 11-22-2009
Posted by lcplben on November 22, 2009, 1:28 pm
Please log in for more thread options


Hi folks --

I don't have much hope for a Eureka! answer, but here goes anyway.

I apologize that I can't post a URL: the page is in pieces all over
the garage floor. But imagine I have a page arranged in an ordinary
way:

show/hide quoted text

show/hide quoted text

show/hide quoted text
[bunch of complicated data]
show/hide quoted text

show/hide quoted text

show/hide quoted text

I replace (via AJAX) the div id="container", and its contained table
id="data", with new stuff when the user asks me to, and that will work
just fine, I do believe. It's somewhat working now.

show/hide quoted text
up, of course it's completely unstyled. I haven't found a way to get
the browser to apply styles from that section or from an external
stylesheet to the new table.

Has anybody any ideas about how I can get the new, AJAX-downloaded
show/hide quoted text
merely humongous to gigantic.

I do see ( http://www.w3.org/TR/html4/present/styles.html#h-14.2.1 )
that I can put out an HTTP header:

Content-Style-Type: text/css

but I don't think that helps the browser find the styles I want.

Thank you, everyone.

-- ben

Posted by Dan Rumney on November 23, 2009, 9:06 am
Please log in for more thread options


show/hide quoted text

Any styling defined for a page will be applied to any elements added to
the DOM.

What seems likely to me is one of two scenarios:

1) The method that you use to add elements to you DOM wipes out the <div
show/hide quoted text

2) Your styling is too specific to the original elements; the new
elements are not matched by any of the selectors in your CSS so no
styling is applied.

This is a case where we need a URL to really figure out what is happening

Dan

Posted by lcplben on November 24, 2009, 6:24 am
Please log in for more thread options


show/hide quoted text

Am I inferring correctly from this that an AJAX-downloaded element (a
show/hide quoted text
and would solve my problem.

show/hide quoted text

show/hide quoted text
with a new div that is /supposed/ to be identical (in id and
everything else) to the old, except only that the new element has new
content.

show/hide quoted text

I didn't think of that. Thanks.

show/hide quoted text

Yes, indeedy. I'll give one next time.

Thanks so much, Dan.

-- ben

Posted by lcplben on November 24, 2009, 6:57 am
Please log in for more thread options



show/hide quoted text

D'oh! OF COURSE the page is re-rendered -- I wasn't thinking straight.
Never mind (tm Emily Litella).

-- ben

Posted by Harlan Messinger on November 24, 2009, 8:59 am
Please log in for more thread options


lcplben wrote:
show/hide quoted text

That is incorrect. But the browser has to render the elements that you
*insert*, and when it does so, it applies the applicable stylesheets to
them the same way it did to the original state of the page.

Similar ThreadsPosted
how to style an AJAX-loaded fragment November 22, 2009, 1:10 pm
Empty fragment July 7, 2005, 10:10 am
Centered fragment in a paragraph June 3, 2008, 3:53 pm
Weird: IE renders fragment of HTML twice January 31, 2006, 5:09 am
XHTML DOCTYPE breaks JavaScript x.style.top and x.style.left? July 5, 2005, 12:58 pm
TR's w no Style? October 5, 2005, 4:27 pm
style=& ? November 22, 2004, 7:24 am
using vars in div style tag January 5, 2005, 4:32 pm
Footnote style September 25, 2005, 8:38 pm
OL tag with style for decrementing? February 28, 2007, 1:09 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Driving a better car - Fuelzilla.com

Cabling site for homeowners and pros alike - Cabling-Design.com

Friends:

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap
Privacy Policy