Hey I am not a guru with ajax I have only used it, maybe two times before. What i am trying to do it create a site were all the content on the pages load through a box called:
<div id="content">
All this works fine. But when you click the enter site button, How do I tell it to load the content for the home page?
on my index page I just have an enter link:
have tried:
<a href="index.html"onLoad="loadXMLDoc('home.html')">here is a link</a>
and
<a href="index.html"onClick="loadXMLDoc('home.html')">here is a link</a>
Here is my code setup for index.html
This in the header-
<script type="text/javascript">
function loadXMLDoc(url)
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET",url,false);
xmlhttp.send(null);
document.getElementById('content').innerHTML=xmlhttp.responseText;
}
</script>
this in the body-
<a href="javascript:void" onClick="loadXMLDoc('about.html')">About Us</a>
<a href="javascript:void" onClick="loadXMLDoc('contact.html')">Contact Us</a>
<div id="content"></div>
Anyone know how to do this??
Thanks!!