View Full Version : AJAX with rollover buttons loading text into a DIV

03-12-2010, 02:44 AM
So after my last thread asking about some DIV problems, ive been re directed to using AJAX, which seems to be exactly what im after.

Im using a snippet of code to call a txt. file to a div when a button is clicked. This works fine but when i decide to change the button to a rollover image instead, the text loads and unloads in about a second.

Any ideas how i can get it to stick until the next rollover button is clicked?

Here is the AJAX code im using:
function loadXMLDoc(url)
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
document.getElementById('bodytext').innerHTML=xmlh ttp.responseText;

and this is my rollover button code:
<a href="" onclick="loadXMLDoc('home.txt')" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('home','','../assets/homeBtnO.png',1)"><img src="../assets/homeBtn.png" alt="home" name="home" width="37" height="14" border="0" id="home" /></a>

thanks in advance

03-16-2010, 03:41 AM
haha sorry, just really need some help on this. Anyone used AJAX before?

03-16-2010, 03:09 PM
Moved to JS, hopefully more luck here.