Results 1 to 2 of 2

Thread: Dynamic Ajax Content: Object Expected error

  1. #1
    Join Date
    Sep 2004
    Location
    Tallahassee, FL USA
    Posts
    264
    Thanks
    71
    Thanked 2 Times in 2 Posts

    Default Dynamic Ajax Content: Object Expected error

    1) Script Title: Dynamic Ajax Content

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...jaxcontent.htm

    3) Describe problem: I'm receiving an Object Expected error. Here is the test page: http://www.summerfoodflorida.org/test.html

    I believe this is due to two issues:
    1. I'm not sure how to code the page so the external pages have CSS styling. The script page (http://www.dynamicdrive.com/dynamici...jaxcontent.htm) has an example when using a regular link, but I'm using the drop down menu where the file loads by simply selecting it.

      I changed the following coding on the test page from this:
      Code:
      function loadobjs(){
      to this:
      Code:
      function loadobjs('/styleframe.css'){


    1. The other issue might be that the external page I'm calling contains a Google batchgeo map using iFrame. Here is the external page I wish to load:
      http://www.summerfoodflorida.org/test1.html

      Any help with this would be greatly appreciated.

      Thanks,
      Deborah
    Deborah Whipp
    Web Designer
    Tallahassee, FL
    www.DWWebDesigns.com

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    #1 is a no-no, it breaks the entire script. Return it to the original.

    Frankly my feeling is that the loadobjs() function in this script is a bit of a red herring. It only really saves loading time initially if what it loads is large. But that increases the chance that what it loads won't be ready in time.

    If you want that stylesheet on the page, just use an ordinary stylesheet link:

    HTML Code:
    <link rel="stylesheet" href="/styleframe.css" type="text/css">
    put it after:

    HTML Code:
    <link rel="stylesheet" type="text/css" href="/style.css">
    It's so small that it won't hurt anything even if it's never used.

    However, it's rule:

    Code:
    body { background-color:#fff; font-family:arial,verdana,sans-serif; font-size:13px; }
    will affect the 'top' page (test.html) and would have done so regardless of how it was loaded, be that manually as I'm recommending, or via loadobjs() if used properly.

    What's the purpose of that style? Are you trying to influence test1.html or batchgeo.com/map/summerfood2010_orange?

    You cannot do the latter. The former should follow the existing styles on the 'top' page (test.html). If these are not sufficient, styles for it should be for the elements in it. But I see the only elements in it are the iframe and a two p's and a small. These should be automatically styled to match any styles for these on the 'top' page. You can use inline style on test1.html, or use the container child selector on the 'top' page, ex:

    Code:
    #contentarea p {
    	color: red;
    }
    By the way, since it's an AJAX import, ideally it's entire contents should be only:

    Code:
    <div><p><iframe src="http://batchgeo.com/map/summerfood2010_orange" frameborder="0" width="100%" height="550" style="border:1px solid #aaa;border-radius:10px;"></iframe></p><p><small>View <a href="http://batchgeo.com/map/summerfood2010_orange" target="_blank">ORANGE COUNTY Summer Food Pgrm – OPEN SITES 2010</a> in a full screen map</small></p></div>
    If you give that div an id, you may use it as the parent in the child selector.

    But you're probably OK with what you have, and can skip entirely the loadobjs() function and skip entirely adding that stylesheet link manually.

    Just remember to return the script code to the original.



    Now on to #2. Since, as far as I can tell, there's no javascript on test1.html, it should/could be fine. The map iframe should load up. It will take whatever time it takes though. Try it and see.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •