By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,604 Members | 1,649 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,604 IT Pros & Developers. It's quick & easy.

Autoscroll to a certain position on page load?

P: 2
Hello all,
I need some help. I am trying to get my page to load at a certain point. I want the page to scroll to a position about a third of the way down right when it comes up. I know there must be some way to do this with an anchor or something, but I can't figure it out.

Any help would be greatly appreciated.

-John
Nov 4 '07 #1
Share this Question
Share on Google+
3 Replies


gits
Expert Mod 5K+
P: 5,390
hi ...

welcome to TSDN ...

have a look here

kind regards
Nov 4 '07 #2

Markus
Expert 5K+
P: 6,050
Orrrrrrrrrrrrrrrrrrrrr, you could just use:

Expand|Select|Wrap|Line Numbers
  1. <html>
  2.  <head>
  3.   <title>Scroll.</title>
  4.    <script language="javascript" type="text/javascript">
  5.     function doScroll()
  6.      {
  7.       window.location="http://yoursite.com/#scroll"
  8.      }
  9.    </script>
  10.  </head>
  11. <body onload="doScroll()">
  12. <!-- filler content! //-->
  13. <p>SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL</p>
  14. <br />
  15. <br />
  16. <br />
  17. <br />
  18. <br />
  19. <br />
  20. <br />
  21. <br />
  22. <p>SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL</p>
  23. <br />
  24. <br />
  25. <br />
  26. <br />
  27. <br />
  28. <br />
  29. <br />
  30. <br />
  31. <p>SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL</p>
  32. <p>SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL</p>
  33. <br />
  34. <br />
  35. <br />
  36. <br />
  37. <br />
  38. <br />
  39. <br />
  40. <br />
  41. <!-- say it's here you want to scroll to, simply give the tag (p) the relative id from the JavaScript code (p id='scroll') and you're laughing.
  42. <p id="scroll">SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL</p>
  43. <br />
  44. <br />
  45. <br />
  46. <br />
  47. <br />
  48. <br />
  49. <br />
  50. <br />
  51. <p>SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL</p>
  52. <br />
  53. <br />
  54. <br />
  55. <br />
  56. <br />
  57. <br />
  58. <br />
  59. <br />
  60. <p>SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL</p>
  61.  
I *think* that should work...
Nov 4 '07 #3

P: 2
.....hey thanks guys
Nov 30 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.