单击照片幻灯片

I am trying to make my photos appear in sequence when I click each one of them. When I click the first image it goes to the second, but I don't get the same for the third.

The code at the main page:

<script>
function loadXMLDoc()
{
var xmlhttp;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","ajax_info.html",true);
xmlhttp.send();
}
</script>



<div id="myDiv">

<h2><a><button type="submit" onclick="loadXMLDoc()"><img src="/project2_ver3/vor/pic5.jpg" alt="vor" width="540" height="418"/></a></button></h2>

</div>

Then the code at ajax_info.html:

<!DOCTYPE html>
<html>
<body>

<script>
function loadXMLDoc2()
{
var xmlhttp;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("myDivv").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","\project2_ver3\ajax_infoo.html",true);
xmlhttp.send();
}
</script>



<div id="myDivv">

<h2><button type="submit" onclick="loadXMLDoc2()"><img src="/project2_ver3/vor/pic2.jpg" alt="vor" width="540" height="418"/></button></h2>

</div>




</body>
</html>

And finally, the code at ajax_infoo.html:

(code trimmed):

xmlhttp.open("GET","ajax_infooo.html",true);
xmlhttp.send();
}
</script>
<div id="myDiv">
<h2><button type="submit" onclick="loadXMLDoc2()"><img src="/project2_ver3/vor/pic1.jpg" alt="vor" width="540" height="418"/></button></h2>
</div>
</body>
</html>

The problem is that you are replacing the complete "myDiv" innerHTML. Doing this will deactivate the onclick function you wrote for the button. Try addressing that problem. That should solve it.