Scrollbar position problem on location.reload()
<div style='height:2000px;'>please scroll down</div>
<a href=# onclick="location.reload();return false;">Reload Page</a>
<div style='hei开发者_运维技巧ght:1000px;'>...</div>
demo here
in chrome or firefox,when I click "Reload Page",the page can revert to my scrolltop,
but in IE(6,7,8),they stay on the top
how to implement revert scrolltop effect like chrome in IE?
thanks for help :)
Use scroll
function, here's an example:
- http://www.java2s.com/Code/JavaScript/Javascript-Objects/WindowscrollExample.htm
Here's an example of <a>
similar to what you want:
<a href="javascript:scroll(0,0)">
Top
</a>
You can combine both if you actually want to scroll and reload.
精彩评论