• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is there a way to automatically default a webpage to a specific area upon load?

 
Gerard Largosa
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to have the webpage automatically default to a specific line after loading? For example, I have a really long webpage, I want the webpage to default on the button, middle or top of the webpage upon refresh. Is this possible? Thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does it mean to "default" a web page?
 
Gerard Largosa
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What I have is a long webpage(manual), on load I want to set it up to show the middle or bottom of the webpage, not the top. By default the webpage automatically shows the user the top of the webpage, I want to set the page up to show the middle or button of the page, on load/reload instead.

So I guess what I meant by "Is there a way to automatically default a webpage to a specific area upon load" means Is there a way to automatically set a webpage to display the middle or bottom on load or reload.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If there is a specific control that you want to set focus to, you could do that in the onload handler.

Otherwise, you could add anchor tags using the name attribute and navigate to them by using #name at the end of the url.

For example, this link to an issue of the JavaRanch Journal:

http://www.javaranch.com/journal/200510/Journal200510.jsp#a1

uses that mechanism to bring you to specific article on that page.
 
Jason Cox
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

[ September 27, 2006: Message edited by: Rob Aught ]
 
Gerard Largosa
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to set focus on an anchor when the page loads? I want it to automatically go to a specific anchor(middle) everytime it is loaded.
 
Jason Cox
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. Just set the anchor label in your URL. For example to get to the middle of the page you might set the anchor tag to look like this -



However, unless you're linking from somewhere else this isn't going to happen.

The only other way would be to do an onLoad call in the body tag.



You'll have to replace "onToad" with "onLoad". Sorry, limitation of the forum.
 
Gerard Largosa
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the all the suggestions, it works now.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic