Connecting Tech Pros Worldwide Help | Site Map

Go to the bottom of the page when the page is loaded

Matt
Guest
 
Posts: n/a
#1: Jul 23 '05
The html page is very long and has a button on the bottom.
How to make the browser go to the bottom of the page when the page
is loaded??

Thanks!
Ivo
Guest
 
Posts: n/a
#2: Jul 23 '05

re: Go to the bottom of the page when the page is loaded



"Matt" wrote[color=blue]
> The html page is very long and has a button on the bottom.
> How to make the browser go to the bottom of the page when the page
> is loaded??
>
> Thanks![/color]

window.scrollTo(0,1000);
works if the page is not longer than 1000 pixels.
To be sure and calculate the real height, see
<URL: http://jibbering.com/faq/#FAQ4_9 >
HTH
Ivo


Dominique
Guest
 
Posts: n/a
#3: Jul 23 '05

re: Go to the bottom of the page when the page is loaded



put the following line at the end of mypage(before </body>)
<a name=bottom></A>
and launch your page
<A href="mypage.html#bottom">my page</A>
bye
--
Ce message a ete poste via la plateforme Web club-Internet.fr
This message has been posted by the Web platform club-Internet.fr

http://forums.club-internet.fr/
bruce
Guest
 
Posts: n/a
#4: Jul 23 '05

re: Go to the bottom of the page when the page is loaded


jrefactors@hotmail.com (Matt) wrote in message news:<ba8a039e.0405262135.5f1dc9fb@posting.google. com>...[color=blue]
> The html page is very long and has a button on the bottom.
> How to make the browser go to the bottom of the page when the page
> is loaded??
>
> Thanks![/color]


Near the bottom of the screen, have an item such as:
<span id="thebottom>xxx</span>
(The span can enclose almost any type of control or text, but watch
out for putting it inside a <table>, I've had problems with this one.)


Then, code the body tag something like this:
<body onload="javascript:window.location.href='#thebotto m'">
Dr John Stockton
Guest
 
Posts: n/a
#5: Jul 23 '05

re: Go to the bottom of the page when the page is loaded


JRS: In article <40b58e05$0$829$a344fe98@news.wanadoo.nl>, seen in
news:comp.lang.javascript, Ivo <no@thank.you> posted at Thu, 27 May 2004
08:43:13 :[color=blue]
>
>"Matt" wrote[color=green]
>> The html page is very long and has a button on the bottom.
>> How to make the browser go to the bottom of the page when the page
>> is loaded??
>>
>> Thanks![/color]
>
>window.scrollTo(0,1000);
>works if the page is not longer than 1000 pixels.
>To be sure and calculate the real height, see
><URL: http://jibbering.com/faq/#FAQ4_9 >[/color]

For most pages, ISTM that window.scrollTo(0,9e9); should do; and
it is shorter than your suggestion. The second parameter should not be
much more than 1.7e13 for my MSIE4.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Grant Wagner
Guest
 
Posts: n/a
#6: Jul 23 '05

re: Go to the bottom of the page when the page is loaded


bruce wrote:
[color=blue]
> jrefactors@hotmail.com (Matt) wrote in message news:<ba8a039e.0405262135.5f1dc9fb@posting.google. com>...[color=green]
> > The html page is very long and has a button on the bottom.
> > How to make the browser go to the bottom of the page when the page
> > is loaded??
> >
> > Thanks![/color]
>
> Near the bottom of the screen, have an item such as:
> <span id="thebottom>xxx</span>
> (The span can enclose almost any type of control or text, but watch
> out for putting it inside a <table>, I've had problems with this one.)
>
> Then, code the body tag something like this:
> <body onload="javascript:window.location.href='#thebotto m'">[/color]

<body onload="
if (window.location.replace) {
window.location.replace(window.location.href + '#thebottom');
} else {
window.location.href = window.location.href + '#thebottom';
}
">
<!-- your page here -->
<a name="thebottom"></a>

Is supported by more browsers, allows you to link directly to "someurl.html#thebottom" and if they bookmark
the resulting page, they end up at the right place on the page without client-side Javascript.

--
| Grant Wagner <gwagner@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
* http://devedge.netscape.com/library/...ce/frames.html
* Internet Explorer DOM Reference available at:
* http://msdn.microsoft.com/workshop/a...ence_entry.asp
* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html


Thomas 'PointedEars' Lahn
Guest
 
Posts: n/a
#7: Jul 23 '05

re: Go to the bottom of the page when the page is loaded


bruce wrote:
[color=blue]
> Near the bottom of the screen, have an item such as:
> <span id="thebottom>xxx</span>
> (The span can enclose almost any type of control or text, but watch
> out for putting it inside a <table>, I've had problems with this one.)
>
>
> Then, code the body tag something like this:
> <body onload="javascript:window.location.href='#thebotto m'">[/color]

This is utter nonsense, misuse of "javascript:" and misuse of J(ava)Script.
It is code I would expect from a script-kiddie. See the FAQ and numerous
postings about why it is a Bad Thing to scroll/focus without consent of the
user. And since not every UA understands IDs, and not every UA that
understands IDs do that for "span" elements, it is not going to work
everywhere, even if we assume that J(ava)Script support is present and
enabled everywhere, which is of course not the case.


PointedEars
Dr John Stockton
Guest
 
Posts: n/a
#8: Jul 23 '05

re: Go to the bottom of the page when the page is loaded


JRS: In article <40B88C26.3040507@PointedEars.de>, seen in
news:comp.lang.javascript, Thomas 'PointedEars' Lahn
<PointedEars@nurfuerspam.de> posted at Sat, 29 May 2004 15:12:06 :[color=blue]
>bruce wrote:
>[color=green]
>> Near the bottom of the screen, have an item such as:
>> <span id="thebottom>xxx</span>
>> (The span can enclose almost any type of control or text, but watch
>> out for putting it inside a <table>, I've had problems with this one.)
>>
>>
>> Then, code the body tag something like this:
>> <body onload="javascript:window.location.href='#thebotto m'">[/color]
>
>This is utter nonsense, misuse of "javascript:" and misuse of J(ava)Script.
> It is code I would expect from a script-kiddie. See the FAQ and numerous
>postings about why it is a Bad Thing to scroll/focus without consent of the
>user.[/color]

It would be naive to assume that the author cannot know what the user
wants.

I have just been working on js-quick.htm, in order to force it to set
the window to a particular size, to scroll to a particular position, and
to focus a particular element on loading - and to resize the window on
unloading. This particular page is written specifically for me to use;
I put it on the Web out of mere benevolence - not for others to use /in
situ/, since that wastes my bandwidth, but for others to copy and use.
They can, if they are in the target readership, easily change or remove
these actions.

The author in this case not only has the consent of the user, but is
working under the user's instructions.

In the OP's case : the design of the page is the responsibility of the
OP and his management. This includes selection of the optimum entry
point. For example, a page showing the family tree (Ahnentafel) of your
descent from, let us say, H C B Moltke, with you at the bottom, might
well be best entered at the end, in the opinion of its designers.

Similarly, forcing a particular large window size, while generally
unwise on the Web, is not inevitably so.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
Do not Mail News to me. Before a reply, quote with ">" or "> " (SonOfRFC1036)
Closed Thread