hey all,

i found a way to click a link and load it into a div. the only problem is that i keep getting the "AHA error" from the if statement in my div.

i'm not sure if it is me or the coding but i'll post what i'm using in jscript here:

function ahah(url, target) {
  document.getElementById(target).innerHTML = ' Fetching data...';
  if (window.XMLHttpRequest) {
    req = new XMLHttpRequest();
  } else if (window.ActiveXObject) {
    req = new ActiveXObject("Microsoft.XMLHTTP");
  }
  if (req != undefined) {
    req.onreadystatechange = function() {ahahDone(url, target);};
    req.open("GET", url, true);
    req.send("");
  }
}  

function ahahDone(url, target) {
  if (req.readyState == 4) { // only if req is "loaded"
    if (req.status == 200) { // only if "OK"
      document.getElementById(target).innerHTML = req.responseText;
    } else {
      document.getElementById(target).innerHTML=" AHAH Error:\n"+ req.status + "\n" +req.statusText;
    }
  }
}

function load(name, div) {
	ahah(name,div);
	return false;
}

and this is what i'm using on the html side

<area shape="rect" coords="255,519,399,558" href="history.html" onclick="load('history.html','leftmain');return false;">

Please let me know where i'm going wrong. i don't think it's because i'm using an image map (i know... ol' skoolin it) but i'm not sure where to go for help.

thanx in advance.

got it guys. just decided to use an iframe

Gr8!!! The script works great. i was able to load the history.html in a specific div

onclick="load('history.html','div')"

History.html
=============
<html>
<head><title></title></head>
<body>
<p>TEST</p>
<script language="javascript">
document.write("Test");
</script>
</body>
</html>


The history page loads successful but the script under the page does not execute.

Please Help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.