Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder
    Join Date
    Jul 2003
    Location
    My pimped-out igloo in Canadia
    Posts
    1,966
    Thanks
    36
    Thanked 0 Times in 0 Posts

    Dynamic Drive AJAX content switcher mishap

    Hi,

    I'm posting here in an effort to cover my bases I'm using this ajax content loader (http://www.dynamicdrive.com/dynamici...jaxcontent.htm) to load .htm files into a central div and I had a question:

    One aspect of this script is that you must declare the external .js ans css files that you want applied to the page, like so:
    Code:
    <a href="javascript:ajaxpage('test.htm', 'contentarea'); loadobjs('external.css', 'feature.js')">test</a>
    <div id="contentarea"></div>
    Now I'm getting an error that I highly suspect is caused by this feature, or by how the ajax script works: When I load a page into the content area, scripts on both the 'parent' page and 'child' page (test.htm) go a bit wonky... however if I test them separately they work fine. Here is my question:

    Theoretically:
    • could the errors be a result of the .js files referencing the <body> tag, wherein once there is a link loaded into 'contentarea' there are technically Two <body> tags
    • or Could they be a result of problems caused by them not being hardcoded into the .htm file but loaded via loadobjs('external.css', 'feature.js')
    • or is there another reason for the mix-ups?


    This post is an extension of a thread here:
    http://www.codingforums.com/showthre...842#post592842

    I didn't want to repost so if you need to see it in action, that's the place

    Thanks again
    Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes :)

  • #2
    Regular Coder
    Join Date
    Feb 2007
    Location
    Seattle
    Posts
    153
    Thanks
    5
    Thanked 9 Times in 9 Posts
    I have run into a similar problem with trying to call a particular external js file. I resolved it by adding the script to the html document, thereby avoiding the external call. Why it does that for certain scripts and not others I do not know.

    You could test it by using this method, which will let you know if the script itself has any bugs.

  • #3
    Senior Coder
    Join Date
    Jul 2003
    Location
    My pimped-out igloo in Canadia
    Posts
    1,966
    Thanks
    36
    Thanked 0 Times in 0 Posts
    Actually that's precisely what i did

    I think it has something to do with the script not being loaded fast enough, or the external .js being loaded (via the script) into the page AFTER it has been fully loaded, therefore throwing errors with any onload events (because as the page loads the scripts arent there yet... that and / or there being two <body> tags now
    Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes :)


  •  

    Posting Permissions

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