PDA

View Full Version : scroll mouse up/down



jmc92
02-02-2010, 05:40 AM
I have an iframe, I would like two image buttons on the outside of the frame (an up arrow and a down arrow) to scroll my iframe onmousedown and stop onmouseup

Can someone please help me with this?
btw this is targeted at older browsers like netscape 4 and IE 5

Nile
02-02-2010, 12:38 PM
In javascript use the 'scrollTop' and 'scrollLeft'
Here's an example (I do not recommend using it though):

jmc92
02-02-2010, 07:56 PM
Here I have two buttons
Only the one at the bottom works
I need the top one to scroll down and the bottom one to do the reverse





<head>
<script>

function stopScroll() {
clearTimeout(scrolldelay);
}

</script>
<script>

}


function pageScroll() {
window.scrollBy(0,80); // horizontal and vertical scroll increments
scrolldelay = setTimeout('pageScroll(3)',100); // scrolls every 100 milliseconds

</script>


<script>
function pageScroll() {
window.scrollBy(0,-80); // horizontal and vertical scroll increments
scrolldelay = setTimeout('pageScroll(2)',100); // scrolls every 100 milliseconds
}


</script>
</head>
<input type="button" onClick="pageScroll(3)" value="Scroll Page">

<a href="javascript:stopScroll()">Stop Scrolling</a>


<BR><BR><BR><BR><BR><BR><BR><BR>
<H1>test</H1>
<BR><BR><BR><BR><BR><BR><BR><BR>
test
<BR><BR><BR><BR><BR><BR><BR><BR>
test




<BR><BR><BR><BR><BR><BR><BR><BR>
<H1>test</H1>
<BR><BR><BR><BR><BR><BR><BR><BR>
test
<BR><BR><BR><BR><BR><BR><BR><BR>
test

<a href="javascript:stopScroll()">Stop Scrolling</a>


<input type="button" onClick="pageScroll(2)" value="Scroll Page">

Nile
02-02-2010, 10:32 PM
Hmm... they both work for me?