Solved

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

Posted on 2004-09-09
9
628 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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…

806 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