logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > Javascript and JS frameworks
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 03-12-2010, 02:44 AM   #1
liverfarm
 
Join Date: Feb 2010
Posts: 23
Default AJAX with rollover buttons loading text into a DIV

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:
Code:
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('bodytext').innerHTML=xmlhttp.responseText;
}
and this is my rollover button code:
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
liverfarm is offline   Reply With Quote
Old 03-16-2010, 03:41 AM   #2
liverfarm
 
Join Date: Feb 2010
Posts: 23
Default

*bump*
haha sorry, just really need some help on this. Anyone used AJAX before?
liverfarm is offline   Reply With Quote
Old 03-16-2010, 03:09 PM   #3
domedia
Administrator
domedia's Avatar
 
Join Date: Dec 2003
Posts: 9,730
Default

Moved to JS, hopefully more luck here.
domedia is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:34 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com