Results 1 to 3 of 3

Thread: impossible to load script with loadobjs

  1. #1
    Join Date
    Jun 2008
    Location
    Chile
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation impossible to load script with loadobjs

    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
    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
    }
    }
    }
    And the code of the page have an script that make work an accordion panel:
    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>
    I can load the css file with loadobjs(), but not the js file and the little script included into the accordion page.

  2. #2
    Join Date
    Jun 2008
    Location
    Chile
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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.?

  3. #3
    Join Date
    Jan 2008
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Has anyone figured this out yet? I'm having the same problem.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •