Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Jump to the bottom of the page?

Posted on 2004-04-05
15
Medium Priority
?
1,401 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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 100 total points
ID: 10756147

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

Accepted Solution

by:
VincentPuglia earned 400 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

Technology Partners: 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

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…
Suggested Courses

564 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