Solved

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

Posted on 2004-09-09
9
626 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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. …
When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
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…

759 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now