Solved

Jump to the bottom of the page?

Posted on 2004-04-05
15
1,367 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
  • 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
 
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
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-…
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…

705 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

21 Experts available now in Live!

Get 1:1 Help Now