Jeśli dwa razy na sekundę wykonuje się pętle, to może być problem. Odciążyć trochę przeglądarkę można po prostu sprawdzając czy zaszły zmiany, wtedy spokojnie można zwiększyć częstotliwość sprawdzania.
<script type='text/javascript'> var change='#'; // zmienna sprawdzajaca
function CheckForHash(){
if(document.location.hash){
var HashLocationName = document.location.hash;
if(HashLocationName == change) return; // jesli taka jest zakladka, nie sprawdzamy dalej
change = HashLocationName; // jesli sprawdzamy, zapamietujemy
HashLocationName = HashLocationName.replace("#","");
document.getElementById(HashLocationName).style.display='block';
document.getElementById('Intructions').style.display='none';
for(var a=0; a<5; a++){
if(HashLocationName != ('Show' +(a+1))){
document.getElementById('Show'+(a+1)).style.display='none';
}
}
}else{
if(change == '') return; // podobnie tutaj
change = ''; // zapamietac tez trzeba
document.getElementById('Intructions').style.display='block';
for(var a=0; a<5; a++){
document.getElementById('Show'+(a+1)).style.display='none';
}
}
}
function RenameAnchor(anchorid, anchorname){
document.getElementById(anchorid).name = anchorname; //this renames the anchor
}
function RedirectLocation(anchorid, anchorname, HashName){
RenameAnchor(anchorid, anchorname);
document.location = HashName;
}
var HashCheckInterval = setInterval("CheckForHash()", 100); // a sprawdzac mozna spokojnie czesciej
window.onload = CheckForHash;
<a id='LocationAnchor' name=''></a> <a href='javascript:RedirectLocation("LocationAnchor", "Show1", "#Show1");'>Display Option 1
</a><br /> <a href='javascript:RedirectLocation("LocationAnchor", "Show2", "#Show2");'>Display Option 2
</a><br /> <a href='javascript:RedirectLocation("LocationAnchor", "Show3", "#Show3");'>Display Option 3
</a><br /> <a href='javascript:RedirectLocation("LocationAnchor", "Show4", "#Show4");'>Display Option 4
</a><br /> <a href='javascript:RedirectLocation("LocationAnchor", "Show5", "#Show5");'>Display Option 5
</a> <div id='Show1' style='display:none;'> 1st Option
<div id='Show2' style='display:none;'> 2nd Option
<div id='Show3' style='display:none;'> 3rd Option
<div id='Show4' style='display:none;'> 4th Option
<div id='Show5' style='display:none;'> 5th Option
<div id='Intructions' style='display:block;'> Click on the above links to see different values, then use the back button to see your browsing history.