I am fairly sure that technically speaking, the <style> tag can only be in the <head> and not the body... 

(Some one please correct me if I am wrong!)

For now I have been doing this as well as just having each modules CSS inline, but it doesnt display the CSS on IE Windows... 

After I posted my original question I found this online...

function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/_javascript_");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}
 

I haven't tested it yet, but this was the sort of thing I had in mind. 

Cheers.

______________________________________________________________________

Alex Duffield . Principal . InControl Solutions . http://www.incontrolsolutions.com 




On 15-Jun-06, at 9:19 AM, Tristan Kelley wrote:

Maybe just have a seperate style sheet for each module? At the beginning of each code section you're calling just include your CSS link:

  <style type="text/css" media="screen">
   @import url(css/style.css);
   </style>

On 6/15/06, Alex Duffield <[EMAIL PROTECTED]> wrote:
I am working on an update to my content management system and I am using a lot of AJAX to load in the different "Modules"

I want each module to be self contained, including all its specific js and CSS. 

Does any one know of a good solution for loading in new CSS to go with the code loaded in via the AJAX call? 

Thanks.
______________________________________________________________________
Alex Duffield . Principal . InControl Solutions . http://www.incontrolsolutions.com  




_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs



_______________________________________________
Rails-spinoffs mailing list

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to