This is my html chunk
<tr>
<td class="c_menu" id="bat_light">
<a href="someLink/file.html#" onclick="OpenItem('light');return false;">sometitle</a>
</td>
<td class="c_menu" id="bat_econom">
<a href="someLink/file.html#" onclick="OpenItem('econom');return false;">
sometitle</a>
</td>
<td class="c_menu" id="bat_standart">
<a href="someLink/file.html#" onclick="OpenItem('standart');return false;">
sometitle</a>
</td>
<td class="c_menu" id="bat_premium">
<a href="someLink/file.html#" onclick="OpenItem('premium');return false;">
sometitle</a>
</td>
</tr>
and this is JavaScript intro at the top
function OpenItem(name){
var blocks = ['light', 'econom', 'standart', 'premium'];
for(var i = 0; i < blocks.length; i++){
if (blocks[i] == name){
document.getElementById('bat_'+blocks[i]).className="c_menu active";
document.getElementById('descr_'+blocks[i]).style.display="block";
document.getElementById('tab_'+blocks[i]).style.display="block";
}
else{
document.getElementById('bat_'+blocks[i]).className="c_menu";
document.getElementById('descr_'+blocks[i]).style.display="none";
document.getElementById('tab_'+blocks[i]).style.display="none";
}
}
}
I understand how to fix page default topscrolling in JQuery,but helpless in this case with simple JS. Rewriting the code to JQuery unacceptable. Tried to set 'this' as second argument to function and then event.preventDefault() - does not work.
return false
should cover this. Check your console to see if there are any other errors in the JS that might cause it to fail before it gets to the end. – Yorktown