jambor Posted October 16, 2008 Share Posted October 16, 2008 I need to automatically refresh webpage every 10 seconds, however i want to maintain scroll position. Unfortunately when using meta refresh or javascript location.reload, page returns to top.Does anyone know how to do this with javascript or aspJames Link to comment Share on other sites More sharing options...
PC_LOAD_LETTER Posted October 16, 2008 Share Posted October 16, 2008 if you know the position itll be in you can refresh it to an anchor (page.htm#anchorname) but if the user scrolls, itll just scroll back to the same spot over and over and that prolly wouldnt workthis page seems to have the answer thoughhttp://blogs.x2line.com/al/articles/156.aspx< html>< title>< /title>< head>< script language="javascript">// function saves scroll positionfunction fScroll(val){ var hidScroll = document.getElementById('hidScroll'); hidScroll.value = val.scrollTop;}// function moves scroll position to saved valuefunction fScrollMove(what){ var hidScroll = document.getElementById('hidScroll'); document.getElementById(what).scrollTop = hidScroll.value;}< /script>< /head>< body onload="fScrollMove('div_scroll');" onunload="document.forms(0).submit()";>< form>< input type="text" id="hidScroll" name="a">< /br>< div id="div_scroll" onscroll="fScroll(this);" style="overflow:auto;height:100px;width:100px;">.. VERY LONG TEXT GOES HERE< /div>< /form>< /body>< /html> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now