473,399 Members | 4,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

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

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!
Jul 23 '05 #1
7 26474
Ivo

"Matt" wrote
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!


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
Jul 23 '05 #2

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/
Jul 23 '05 #3
jr********@hotmail.com (Matt) wrote in message news:<ba**************************@posting.google. com>...
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!

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'">
Jul 23 '05 #4
JRS: In article <40*********************@news.wanadoo.nl>, seen in
news:comp.lang.javascript, Ivo <no@thank.you> posted at Thu, 27 May 2004
08:43:13 :

"Matt" wrote
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!


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 >


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.
Jul 23 '05 #5
bruce wrote:
jr********@hotmail.com (Matt) wrote in message news:<ba**************************@posting.google. com>...
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!


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'">


<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 <gw*****@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
Jul 23 '05 #6
bruce wrote:
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'">


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
Jul 23 '05 #7
JRS: In article <40**************@PointedEars.de>, seen in
news:comp.lang.javascript, Thomas 'PointedEars' Lahn
<Po*********@nurfuerspam.de> posted at Sat, 29 May 2004 15:12:06 :
bruce wrote:
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'">


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.


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)
Jul 23 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Guadala Harry | last post by:
I'm using HTML tables to define the layout of a non framed aspx page. How can I cause a page footer (html table, itself) to appear at the bottom of the page when the page content would not be...
0
by: Greg | last post by:
Most suggestions on this topic recommend to use a page footer and make it visible only on the last page. My problem is that the footer is half of the height of a page which means the detail would...
5
by: mail2kondeti | last post by:
Hi Here I need know small clarification. I did this long time back. If I want to show the cursor in the first field when the page gets loaded, how we have to do? Ex. if you goto...
1
by: activeashish | last post by:
I have just installed apache 2.2.4 and php5 , When ever i call a php page on web browser only half of the page is getting loaded and on IE it is not even getting loaded
4
by: moondaddy | last post by:
I have a .net 1.1 winforms app that calls an aspx page which I need to debug. I also need to start the debugging process from the winform because the winform first calls a web service which passed...
1
by: mbruyns | last post by:
i have been trying (and sometimes succeeding) to use the modalpopupextender to show various panels of controls on my asp pages. the strange problem that i keep on running into is that sometimes it...
1
by: ismailc | last post by:
Hi, i'm using an xslt file that loads my page - which does not use a body. The problem i have is that everytime i open the page the focus is on the submit button. I don't really want that - where...
5
by: bnashenas1984 | last post by:
Hi everyone Actually I'm not sure if I have to post this question in PHP forum. I have a page (download page) which contains a link but I want the link to be invisible until the page is fully...
7
by: tomaz | last post by:
I have following situation: <body onLoad= "Init()"> my external javascript function (included in the html page): function Init() { if (CtFlgTouchScreen == true) { var script =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.