Hello, can anyone help me with this function?
i’m doing a replace, the content appears inside the div “foo”.
now i want to have like 3 or 4 links with the funcione replace and each one replace his own content.
my code so far and working is:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script type="text/javascript">
var http = false;
if(navigator.appName == "Microsoft Internet Explorer") {
http = new ActiveXObject("Microsoft.XMLHTTP");
} else {
http = new XMLHttpRequest();
}
function replace() {
http.open("GET", "conteudo.php?id=1", true);
http.onreadystatechange=function() {
if(http.readyState == 4) {
document.getElementById('foo').innerHTML = http.responseText;
}
}
http.send(null);
}
</script>
</head>
<body>
<div class="accordion_content">
<h2><p><a href="javascript:replace()">link 1</a></p>
<div id="foo">
here appear the content
</div></h2>
</body>