Click to See Complete Forum and Search --> : Automaticly scroll to the bottom
maw_webdesign
03-19-2003, 02:57 AM
Hi there...
I'd like to know if there is a way to let a html-page scroll automaticly to the bottom of the page...
Thnx,
MAW
Martin76
03-19-2003, 04:32 AM
Did you want it to start at the bottom? Or slowly scroll to the bottom? Either way sounds like a bit of scripting to me. Remember when there's a will there's a way. Java sounds like it would work best, but then it depends on what you know. Just answer the first question and I'm sure we can help you out. By saying that I mean me and all the peeps inside my head.
maw_webdesign
03-19-2003, 04:39 AM
It should start at the bottom...
Thnx for helping me...
:)
Martin76
03-19-2003, 04:56 AM
Sorry didn't realize that you replied, alright here's the deal, I'm not much of one to do things for people unless you can't learn or something so, to start off with do you know javascript? Also do you know what a bookmark is? There are three ways you can do it the really easy way and have them click a link that will refer them to a bookmark on the next page (the bottom). The almost retarded way and just have them click at the top to get to the bottom, or the hard way ... refernce javascript to "click" the bookmark for you. Mind you I'm not all that good at this so you'll have to bear with me. Of course I never mind if someone else decides to help.. *smiles* alright, so what will it be?
maw_webdesign
03-19-2003, 06:21 AM
Thnx... :)
I'd like javascript to click for me.
Martin76
03-19-2003, 09:31 PM
Well I was working on a javascript program to do it and my friend walks in and asks me "what are you doing?" and dumbfoundedly I said making a website that scrolls to the bottom, well he just looked at me and asked is there something else you want it to do as well? and I said not really. so he did this at the bottom of a bunch of a's and breaks
<a name="atbottom"></a>
and then he said.. Look all you have to do is specify in the URL or Link to the page where you want it to go... aka
http://thepage.domain.ext/thepage.html#atbottom
the # sign is the key to referencing to a bookmark, but I didn't realize that you could do this easily by adding it to the URL. If you want to do it by index.html I suggest just haveing the page "re-route" to the link. OTher than that I don't really feel like finishing my program unless there is a crusial reason.
maw_webdesign
03-20-2003, 02:23 AM
I tried this one, but it didn't work in all the browsers...
So, could you please finish the code you're working on?
Thnx,
MAW
Martin76
03-20-2003, 02:26 AM
Sure, why not... Might take me some time though because I just started coding some dhtml for one of my sites, and I also been working on some flashy flash heh... But as soon as I'm done it will be in your hands.
Code One
03-20-2003, 11:23 PM
Just put this in the body of your html page:
Code:
<script language="JavaScript1.2">
var currentpos=0,alt=1,curpos1=0,curpos2=-1
function initialize(){
startit()
}
function scrollwindow(){
if (document.all)
temp=document.body.scrollTop
else
temp=window.pageYOffset
if (alt==0)
alt=1
else
alt=0
if (alt==0)
curpos1=temp
else
curpos2=temp
if (curpos1!=curpos2){
if (document.all)
currentpos=document.body.scrollTop+1
else
currentpos=window.pageYOffset+1
window.scroll(0,currentpos)
}
else{
currentpos=0
window.scroll(0,currentpos)
}
}
function startit(){
setInterval("scrollwindow()",10)
}
window.onload=initialize
</script>
Merry X-mas!
Code One