SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Dec 2003
    Location
    Centreville, VA
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Q] How to update one DIV frame from another???

    Howdy...

    I have two DIV frames...
    HTML Code:
    <body>
        <div id="leftcol"><?php include("navL.html"); ?></div>
        <div id="content"><?php include("content.php"); ?></div>
    </body>
    and in the leftcol DIV frame, I have navL.html file loaded... (If you know of better way of doing it, please let me know... )

    This is the content of the navL.html file...
    HTML Code:
    <script type="text/javascript">
        <!--
    
        function load(arg)
        {
            alert(arg);
            document.getElementByID("content").src = arg + ".html";
        }
    
        //-->
    </script>
    
    <a href="#" onClick="javascript:load('test1');">test1</a>
    <BR>
    <a href="#" onClick="javascript:load('test2');">test2</a>
    In there I have two links which I want to use to update the content DIV frame with either test1.html or test2.html depending on the link that is clicked, but somehow it is not working...

    Does anybody know how I can solve this problem???

    Thank you very much...

  2. #2
    SitePoint Addict markchivs's Avatar
    Join Date
    Oct 2004
    Location
    Malvern Hills, UK
    Posts
    233
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    document.getElementByID("content").src = arg + ".html";
    This line doesnt instruct the page to request the html page from the server. Thats the problem

    You could use xmlHTTP to request the HTML content and change your content DIV. There's examples on the forums here and a couple of articles, so I won't reiterate whats been already post.




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
  •