Hi,
I need some help with this script. It works and everything, it’s just I’m using it on a big page and it keeps scrolling back to the top every time you click on a link to toggle display.
Here is the header:
<script type=”text/javascript”>
<!–
function toggle_visibility(id) {
var e = document.getElementById(id);
if(e.style.display == ‘none’)
e.style.display = ‘block’;
else
e.style.display = ‘none’;
}
//–>
</script>
And here is a link:
<a href=”#” onclick=”toggle_visibility(‘foo’);”>Show More</a><div id=”foo” style=’display:none;’>This is foo</div>
Every time this link is clicked, it will scroll back up to the top of the page as if it were a #top command. Is there any way to prevent that?
Thanks in advance.