Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

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

Status
Not open for further replies.

CyanBlue

Technical User
Mar 6, 2002
16
US
Howdy... :)

I have two DIV frames...
---
<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...
---
<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... :)
 
Thanks for the reply, Foamcow... :)

That href did not do the job... It seems like there is something I am missing but I don't know what it is since I am no good at this HTML/JavaScript stuff... :(
(I have posted the same question to the JavaScript from as you have mentioned... Thanks...)
 
First of all, there is no such JavaScript function as [tt]getElementByID()[/tt]. JavaScript is CaseSensitive, and therefore that particular function should be [tt]getElementByI[red]d[/red]()[/tt].

*cLFlaVA
----------------------------
[tt]tastes great, less filling.[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Don't use Javascript to do this, just use ordinary (i)frames.

Or, better IMO, write your pages like this:
Code:
<!-- Page 1 -->
<body>
    <div id="leftcol"><?php include("navL.html"); ?></div>
    <div id="content">This is the actual content of page 1</div>
</body>

Code:
<!-- Page 2 -->
<body>
    <div id="leftcol"><?php include("navL.html"); ?></div>
    <div id="content">This is the actual content of page 2</div>
</body>

Your nav include can then use just regular links between the pages.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top