<script type="text/javascript">
$(document).ready(function(){
if(window.location.hash) {
var hash = window.location.hash;
var page = $(hash).attr('href');
$("#content").load(page);
}
$('a[id*=page]').click(function(event){
var href = $(this).attr('href');
var hash = $(this).attr('id');
$.ajax({
url: href,
success: function(data){
$("#content").html(data);
window.location.hash = hash;
}
});
event.stopPropagation();
return false;
});
});
</script>
<ul>
<li><a id="page1" href="page1.php">Page 1</a></li>
<li><a id="page2" href="page2.php">Page 2</a></li>
<li><a id="page3" href="page3.php">Page 3</a></li>
<li><a id="page4" href="page4.php">Page 4</a></li>
</ul>
<div id="content"></div>