Solved

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

Posted on 2004-09-09
9
631 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
[X]
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
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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…

734 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