Even if your anchors have unique tag names, when you navigate through browser history and go back to that particular anchor, it's not going to execute the javascript associated with the onClick of that anchor.
You need to set window.onhashchange to call your show function. You don't even need onclick after the change. I've tested the follow:
<pre>
<html>
<head>
<script type="text/javascript">
window.onhashchange=window.onload=function(){
window.setTimeout(doHashCheck, 10);
}
var doHashCheck = (function(global) {
return function() {
var addr = window.location.hash.replace(/^#/,'');
show(addr);
}
})(this);
function show(addr)
{
a=new XMLHttpRequest();
a.onreadystatechange=function()
{
if (a.readyState==4 && a.status==200)
{
document.getElementById("content").innerHTML=a.responseText;
}
}
a.open("GET",addr+".php",true);
a.send(); //
}
</script>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache" />
<META HTTP-EQUIV="Expires" CONTENT="-1" />
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, no-store, must-revalidate" />
</head>
<a href="#1">Load 1.php into content</a>
<a href="#2">Load 2.php into content</a>
<a href="#3">Load 3.php into content</a>
<a href="#4">Load 4.php into content</a>
<!-- Load content here-->
<div id="content"></div>
</body>
</html>
</pre>