Solved

A javasrcipt: URL that scrolls the current page to the end?

Posted on 2004-09-09
9
630 Views
Last Modified: 2008-01-09
Hi,

I get some HTML Logging output from a very simple HTTP  server. But it quickly runs down the bottom of the browser window so I need to scroll all the time to see the most current messages.

Can you please help me to write such a fancy javascript: URL bookmark  that constantly scrolls to the end of the current document?
0
Comment
Question by:x4u
9 Comments
 
LVL 36

Accepted Solution

by:
Zyloch earned 168 total points
ID: 12022635
Hi

You could put this:

<body onload="scrollBottom();">

and have this:

function scrollBottom() {
   scrollBy(0,document.body.scrollHeight);
}

Regards,
Zyloch
0
 
LVL 11

Author Comment

by:x4u
ID: 12022689
The page loading is never finished so unload will never be called.  There is constantly new content added to the page while the log is running and I want it scroll to the button all the time not just once.

If at all possible I'd prefer not to insert anything into the page code but have it in a seperate javascript: URL that can be called from a bookmark if needed.
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 12022731
It depends on how the new information is being added to the page...
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 11

Author Comment

by:x4u
ID: 12022883
It is simply appended to the document. The page keeps on loading all the time.
It is similar to a very slow server that serves a infinite long page.
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 12022932
Ah, you mean chunked transfer? The anchor tag would actually be harder to implement. I know you can do this: (not sure if supported in Mozilla, but should work in IE):

Have this in the <head> section:

<script language="javascript" type="text/javascript">
<!--

function scrollBottom() {
   scrollBy(0,document.body.scrollHeight);
}

var tid = setInterval('scrollBottom()',2000);
//The 2000 means 2000 milliseconds or 2 seconds

//-->
</script>

Then have this:

<body onload="clearInterval(tid);">
0
 
LVL 8

Assisted Solution

by:a_twixt_in_the_tale
a_twixt_in_the_tale earned 166 total points
ID: 12025126
change the address of one of ur links to
   javascript:scrollBy(0,window.document.body.scrollHeight);
apply and click OK (ignore popups)

use this link to move to the end of the page. u will however have to click on this link each time to move to the current 'end'
however it saves using the scrollbar

i tried a recursive loop using setTimeout but it will eventually gobble up too much mem. and freeze ur system

:)
Don
0
 
LVL 10

Assisted Solution

by:daleoran
daleoran earned 166 total points
ID: 12025628
Could you just put a hyperlink at the top of the page

<a href="#bottomofpage">Bottom</a>

Page contents go here
Page contents go here
Page contents go here
Page contents go here
Page contents go here
Page contents go here

<a name="bottomofpage">The End

Michael

0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question