Hello I am using a small, simple script to update a content box labeled
contentDiv. To call the function I am using a link on my homepage (index.htm) which looks like the following:
Code:
<a class="" href="#" onclick="loadXMLDoc(0)">featured</a>
And here is my js function:
Code:
function loadXMLDoc(DocNum)
{
DocNames=['../content/featured.php','../content/news.php','../content/projects.php','../content/nomads.php','../content/rfrancis.php'];
MyDoc=DocNames[DocNum];
var xmlhttp;
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("contentDiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET", MyDoc ,true);
xmlhttp.send();
}
So far all of this works perfectly, so this is where I'm getting stuck. Let us assume I clicked the
'featured' link above and my
contentDiv area changed to the content within
featured.php. Is it possible or how would I go about making a link within the
featured.php page to the SAME area (
contentDiv)?
Example:
I click the link to load featured.php into contentDiv, and within featured.php is yet another link which can change contentDiv to anyother.php... Possible???