homepage Welcome to WebmasterWorld Guest from 54.161.240.10
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
click to show text needs a focus
click to show text needs a focus
kokopoko




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

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.

 

garann




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

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";

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved