Anche se le tue ancore hanno nomi di etichette univoci, quando navighi attraverso la cronologia del browser e torni a quella particolare ancora, non eseguirà il JavaScript associato all'OnClick di quell'ancora.
È necessario impostare Window.onhashchange per chiamare la funzione dello spettacolo. Non hai nemmeno bisogno di OnClick dopo il cambiamento. Ho testato il seguito:
<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>