fohanlon Posted September 8, 2009 Share Posted September 8, 2009 Hi Guys I want to create anchor tags. I know how to do this with html. Here is my problem: <a href="#myanchor">Go to my anchor</a> Then I have the <a name set up But the page reloads with a url as follows: mypage.php?id=19#myanchor Where id is an id of a page in a mysql db to pull content. I have a mod rewrite so the above url is mypage/19#myanchor Any help to solve this word be appreciated thanks Fergal. This is not working Quote Link to comment Share on other sites More sharing options...
gr1zzly Posted September 8, 2009 Share Posted September 8, 2009 Okay so my understanding is that you want the page to scroll to the anchor after it's been compiled by php. Yes? I'm not an expert but it sounds as though you need a client side function to interact with the page once it's been generated. This ( afain ) cannot be done with php which is sever side, you should try javascript or something that works on the client side. Mootools has a nice smooth scroll function in it's 'More' module. http://mootools.net/ Quote Link to comment Share on other sites More sharing options...
dreamwest Posted September 8, 2009 Share Posted September 8, 2009 <script> function toggleSections(section) { document.getElementById(section).style.display = "block"; document.remember_page.my_value.value = section; document.remember_page.submit(); return false; } function onload_remember_page() { // always store the current page on page load document.remember_page.my_value.value = "details"; document.remember_page.submit(); } </script> <a href="#details" onclick="toggleSections('details_57');return false; " >show</a> <div id="details_57" style="display: none" >hidden stuff here</div> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.