I use XMLHttpRequest to dynamically change the content of a page:
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("txtHint").innerHTML = this.responseText;
}
};
xmlhttp.open("GET","jeudip.php",true);
xmlhttp.send();
jeudip.php return html code (a list of image + javascript): here is a sample of what it return:
<p class="col1">nice picture1 <a id="exemple2" href="http://toto.fr/plat/spe1.jpg"><img width="60" alt="exemple2" src="http://toto.fr/plat/spe1.jpg"></a></p>
<p class="col1">nice picture2 <a id="exemple2" href="http://toto.fr/plat/spe2.jpg"><img width="60" alt="exemple2" src="http://toto.fr/plat/spe2.jpg"></a></p>
...
exemple2 is javascipt stuff that allow to make the image bigger (like facebook) but when the html + javascript code is returned by XMLHttpRequest, if I click on the picture, it didn't call the javascipt and just go to the picture (in the exemple http://toto.fr/plat/spe1.jpg). If call in the browser directly jeudip.php, the javascript work..
I hope I am clear about my problem as my english is not very good. thanks for any help.