0

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!!

Edited by bjeffries: n/a

1
Contributor
1
Reply
2
Views
7 Years
Discussion Span
Last Post by bjeffries
0

Wow, I guess that was a dumb a question.. I just need to put the Code in the box that I want displayed on the first arrival.. I didn't think ajax knew to change that.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.