Solved

Jump to the bottom of the page?

Posted on 2004-04-05
15
1,378 Views
Last Modified: 2008-02-01
Im not a JavaScript developer, but I need a snipit of JavaScript code for a C# application I am writting that uses a HTML Rendering control.

How do I "jump" to the bottom of my page.

Thank you for your time,
Arrummzen
0
Comment
Question by:Arrummzen
[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
  • 6
  • 5
  • 3
  • +1
15 Comments
 
LVL 12

Expert Comment

by:venkateshwarr
ID: 10756038
Is that what you want??

<a href="#bottom"> jump to last page </a>
.
.
.
.
. page contents..
.
.
.
<a name="bottom"> </a>
0
 
LVL 1

Author Comment

by:Arrummzen
ID: 10756047
A: It must happen automaticly, no user interaction
B: The document changes dynamicly at runtime, I don't know were the bottom is...

Thank you for your time,
Arrummzen
0
 
LVL 12

Expert Comment

by:venkateshwarr
ID: 10756050
try this.

<body onload="window.location='#bottom';">
0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
LVL 12

Expert Comment

by:venkateshwarr
ID: 10756061
<body onload="window.location='#bottom';">
.
.
. pagecontents.
.
.
<a name="bottom"> </a>
</body>
0
 
LVL 1

Author Comment

by:Arrummzen
ID: 10756066
A: Is that a standard HTML feature?

B: I can't control the entire document, I can only control what is put inside the <body> </body> tags. Is there anyway I can put the onload= thing (whats it called?) inside the body?

C: Is it a sign that you need to get to bed when colors start to change and things become blury?

Thank you for your time,
Arrummzen
0
 
LVL 12

Expert Comment

by:venkateshwarr
ID: 10756113
A: yes
B: Instead of onload just call the jumptoloc() function...
C: May be

<SCRIPT LANGUAGE="JavaScript">
function jumptoloc(locatn)
{
      window.location=locatn;
}
</SCRIPT>


.
.
.
.
.
.
<SCRIPT LANGUAGE="JavaScript">
jumptoloc('#bottom');
</SCRIPT>

<a name="bottom"> bottom</a>

0
 
LVL 12

Assisted Solution

by:venkateshwarr
venkateshwarr earned 25 total points
ID: 10756147

 you can call jumptoloc from anywhere...
0
 
LVL 15

Accepted Solution

by:
VincentPuglia earned 100 total points
ID: 10756959
Hi,

Actually, the location needs to have been read and interpreted before it can jump.  Therefore, the script needs to go after the html anchor -- note that the text between the '<a>' tags is optional.  

<body...>
...content...
<a name='bottom'> </a>
<script type='text/javascript'>
window.location = '#bottom';
</script>
</body>

Vinny
0
 
LVL 25

Expert Comment

by:devic
ID: 10759781
scrollTo(0,document.body.scrollHeight);
0
 
LVL 25

Expert Comment

by:devic
ID: 10769568
my example ignored and it works without any anchor
0
 
LVL 1

Author Comment

by:Arrummzen
ID: 10769603
<SCRIPT language=\"JavaScript\"> scrollTo(0,document.body.scrollHeight); </SCRIPT>

I get a runntime error - "An error has occured in the script on this page"

Im not relly sure what im doing, the control is being a pain. If you can tell me how to get it to work without an error occuring, I will post another question for you.

Thank you for your time,
Arrummzen
0
 
LVL 1

Author Comment

by:Arrummzen
ID: 10769610
By the way, the above code is in the <body></body> tags.

Thank you for your time,
Arrummzen
0
 
LVL 1

Author Comment

by:Arrummzen
ID: 10769614
And the error is : Object required.

Thank you for your time,
Arrummzen
0
 
LVL 25

Expert Comment

by:devic
ID: 10769657
this is ok, body tag needed
<body>
<script>scrollTo(0,document.body.scrollHeight);</script>
</body>


make one test. Scroll this page to the top and paste in adress bar line below and push enter:
===========
javascript:scrollTo(0,document.body.scrollHeight);
0
 
LVL 1

Author Comment

by:Arrummzen
ID: 10769705
It worked. Post your solution in this question please:

http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_20945697.html

Thank you for your time,
Arrummzen
0

Featured Post

Independent Software Vendors: 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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Rotate images for Web Page 11 38
PHP Web Development 6 64
Read text on Table 7 46
CSV export single column not inserting comma's in file 11 62
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

738 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