jambor Posted October 16, 2008 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
PC_LOAD_LETTER Posted October 16, 2008 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>
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now