1) Script Title: Dynamic Ajax Content
2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...jaxcontent.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
And the code of the page have an script that make work an accordion panel:HTML Code: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 can load the css file with loadobjs(), but not the js file and the little script included into the accordion page.HTML Code:<script src="SpryAssets/SpryAccordion.js" type="text/javascript"></script> <link href="SpryAssets/SpryAccordion.css" rel="stylesheet" type="text/css" /> </head> <body> <p>Welcome </p> <div id="Accordion1" class="Accordion" tabindex="0"> <div class="AccordionPanel"> <div class="AccordionPanelTab">TAB1</div> <div class="AccordionPanelContent">Content1</div> </div> <div class="AccordionPanel"> <div class="AccordionPanelTab">TAB 2</div> <div class="AccordionPanelContent">Content2 </div> </div> </div> <script type="text/javascript"> <!-- var Accordion1 = new Spry.Widget.Accordion("Accordion1"); //--> </script>



Reply With Quote

Bookmarks