Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2004-09-09
9
629 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…

860 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