Welcome to WebmasterWorld Guest from 54.205.75.60

Forum Moderators: open

Message Too Old, No Replies

click to show text needs a focus

click to show text needs a focus

   
3:28 pm on Jul 17, 2008 (gmt 0)

10+ Year Member Top Contributors Of The Month



I've got some text that appears if you click "sitemap". The sitemap text appears at the bottom of the page. I want the focus to go there so the page scrolls down to it. I can't however seem to get anything I try to work.

Here's what I've got right now.

<script language="javascript">
<!--//

function footer_hideall()
{
document.getElementById('layer_sitemap').style.display="none";
document.getElementById('layer_moreinfo').style.display="none";
}

function footer_display(my_object)
{
footer_hideall();
if(document.getElementById(my_object).style.display != "")
{
document.getElementById(my_object).style.display = "";
window.getElementById(my_object).focus();
}
else
{
document.getElementById(my_object).style.display="none";
}
}
//-->
</script>

<a href="javascript: footer_display('layer_sitemap')" class="link_footer" onclick="window.scrollTo(0,document.getElementById('tabber').offsetTop);return false;">SITE MAP</a>

<div id="tabber" style="overflow: auto;">
<div id="layer_sitemap" style="padding-top: 0px;">
stuff
</div>

I could use some help.

6:03 pm on Jul 17, 2008 (gmt 0)

10+ Year Member



If you add this to the place in your script where you want the focus to change, it should work like clicking an anchor:

window.location = window.location + "#layer_sitemap";