acidglitter Posted August 19, 2008 Share Posted August 19, 2008 i'm working on this online store, and when you're looking through a category, to get to the next page, the next link is like <a href="" onclick="browsecategories();return false;">next</a>. then that javascript function uses ajax to load another page that loads the next page of products. the problem i'm having with this is for people with smaller monitors. they'll click the next link, and instead of the window going to the top of the list of products, it stays where it is. what i want it to do is go to the top of the list everytime you click next. does anyone know how i can do that? Link to comment https://forums.phpfreaks.com/topic/120432-javascript-links/ Share on other sites More sharing options...
lemmin Posted August 19, 2008 Share Posted August 19, 2008 linking to a blank anchor should do that: <a href="#" onclick="browsecategories();return false;">next< /a > Link to comment https://forums.phpfreaks.com/topic/120432-javascript-links/#findComment-620562 Share on other sites More sharing options...
acidglitter Posted August 19, 2008 Author Share Posted August 19, 2008 i actually have the # right now, but with return false the browser doesn't actually go to page.php# Link to comment https://forums.phpfreaks.com/topic/120432-javascript-links/#findComment-620578 Share on other sites More sharing options...
lemmin Posted August 19, 2008 Share Posted August 19, 2008 Yeah, I didn't mean to leave that in there. Why do you want to keep the return false if you DO want the link followed? It should do exactly what you want if you remove it. Link to comment https://forums.phpfreaks.com/topic/120432-javascript-links/#findComment-620587 Share on other sites More sharing options...
acidglitter Posted August 25, 2008 Author Share Posted August 25, 2008 i don't want the link followed. it gets to the next page with a javascript function. i just want the browser window to move higher up on the page. Link to comment https://forums.phpfreaks.com/topic/120432-javascript-links/#findComment-625462 Share on other sites More sharing options...
Ken2k7 Posted August 25, 2008 Share Posted August 25, 2008 <a href="javascript:scroll(0,0);void(0);" onclick="browsecategories();return false;">next</a> Link to comment https://forums.phpfreaks.com/topic/120432-javascript-links/#findComment-625479 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.