View Full Version : impossible to load script with loadobjs

06-05-2008, 06:26 PM
1) Script Title: Dynamic Ajax Content

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm

3) Describe problem:

Hi, I think that is a very recurrent problem but I donīt find the solution. I've problem loading the javascript using ajax with this function

function loadobjs(){
if (!document.getElementById)
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.setAttribute("src", file);
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
if (fileref!=""){
loadedobjects+=file+" " //Remember this object as being already added to page

And the code of the page have an script that make work an accordion panel:

<script src="SpryAssets/SpryAccordion.js" type="text/javascript"></script>
<link href="SpryAssets/SpryAccordion.css" rel="stylesheet" type="text/css" />

<p>Welcome </p>

<div id="Accordion1" class="Accordion" tabindex="0">
<div class="AccordionPanel">
<div class="AccordionPanelTab">TAB1</div>
<div class="AccordionPanelContent">Content1</div>
<div class="AccordionPanel">
<div class="AccordionPanelTab">TAB 2</div>
<div class="AccordionPanelContent">Content2 </div>
<script type="text/javascript">
var Accordion1 = new Spry.Widget.Accordion("Accordion1");

I can load the css file with loadobjs(), but not the js file and the little script included into the accordion page.

06-06-2008, 01:12 AM
Nobody know how to do that? I read a lot of question but no answer about the function of this script. ŋWhy load the css but dont the js files or the javascript into the page requested.?

07-04-2008, 01:37 AM
Has anyone figured this out yet? I'm having the same problem.