Mellow Yellow
Nov 8 2004, 02:57 AM
I was wondering, if it is at all possible to have a button, and when you click it, the iframe's scrollbars will go to a certain position. Kind of like the Javascript:scroll, but pertaining to an iframe's scrollbars.
I have tried adding document.iframe's name.scrollBy(x,y) in the onclick of a button, but it does not work. I am getting confused, and desperate. Any help would be greatly appreciated.
Willy Duitt
Nov 8 2004, 03:29 AM
Try:
scrollTo(x,y) instead...
This is the only example I have handy...
Not an iframe but if you need an iframe example you will need to post your codes...
CODE
<script>
function test(n){
p=document.f1[n].offsetTop-20
window.scrollTo(0,p)
}
</script>
<form name="f1">
<input type="text" name="t1" value="Textbox 1">
<input type="button" value="Next" onclick="test('t2')">
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<input type="text" name="t2" value="Textbox 2">
<input type="button" value="Next" onclick="test('t3')">
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<input type="text" name="t3" value="Textbox 3">
<input type="button" value="Next" onclick="test('t4')">
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<input type="text" name="t4" value="Textbox 4">
<input type="button" value="Next" onclick="test('t5')">
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<input type="text" name="t5" value="Textbox 5">
<input type="button" value="Next" onclick="test('t1')">
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<form>
.....Willy
wouldn't normal anchors work?
welcome to the forums by the way Mellow