Results 1 to 3 of 3

Thread: Dynamic page loader - help please

  1. #1
    Join Date
    Jan 2007
    Location
    Annapolis, MD
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Dynamic page loader - help please

    Attempting to integrate a dynamic loader into an existing page. When a link is clicked on the sidebar, I would like load content from an include file. The closes thing I've got to that is here:
    Code:
    <head>
    <script language="Javascript">
    function dynamicTest()
    {
            test.innerHTML = 'Test Successful';
    }
    </script>
    </head>
    <body>
    <table border="1" width="100&#37;" height="250">
            <tr>
                    <td width="50%">
                            <a href="javascript: dynamicTest()">testlink</a>
                    </td>
                    <td>
                            <span id="test">test undergoing</span>
                    </td>
            </tr>
    </table>
    </body>
    I just want to take the contents of a .inc file and dump it straight into the span section instead of just a string with a few tags, while only refreshing that part of the page.

    I have very limited knowledge of javascript, but I'm pretty good with php, html, and CSS.

  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

    Ajax is the way to go with this if you want it just as you say. There are less glamorous and perhaps better ways to accomplish the same effect though, depending upon just what the requirements are. One idea that comes to mind is replacing your span with an iframe and simply target it with links to your external pages. In any case, you will probably want to investigate what Ajax can do in this regard so, see:

    http://www.dynamicdrive.com/dynamici...jaxcontent.htm

    to get an idea of its power and:

    http://www.dynamicdrive.com/dynamicindex17/indexb.html

    for a listing of scripts using Ajax and other approaches that may work out for you.

    One big draw back with Ajax is that any script that needs to run against the newly loaded content, if it requires initialization, needs extra code to get it to work, if it can be made to work at all.
    - John
    ________________________

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

  3. #3
    Join Date
    Jan 2007
    Location
    Annapolis, MD
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    That's exactly what I want. Well done and thank you very much.

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
  •