Iframe options?

D

David

I would like to know if there is a way to set iframes to
autoscroll? I have seen iframe generators on various sites
that has that option, I tried using it in frontpage but it
doesn't seem to work. The option I tried using was
scrolling="auto".
 
M

maak

Hello,
I would like to know if there is a way to set iframes to
autoscroll? I have seen iframe generators on various
sites that has that option, I tried using it in
frontpage but it doesn't seem to work. The option I
tried using was scrolling="auto".

"scrolling=auto" does mean that the browser shows the
scrollbars if they are needed and hide them in the other
cause.

Try (in the document shown in the iframe):
<script language=javascript>
function autoScroll()
{ document.scrollBy(x,y);
document.setTimeout("autoScroll()",ms);
}
</script>

Arguments:
x,y - how many pixels the browser should scroll left (x)
and down (y)
ms - Milliseconds the browser has to wait until
scrolling again.
It's an endless-function. The scrolling itselfs end at the
bottom of the page, of course.

You may have to adapt the code for special requirement.


maak
 
M

maak

Hello,
<iframe name="I1" width="822" height="386"
frameborder="0" scrolling="auto" align="center"
src="http://www.midkiffhub.com/gallery">
Your browser does not support inline frames or is
currently configured not to display inline
frames.</iframe></p>

Actually - (ähm) I forgot something:
Add
onload=javascript:autoScroll()
into the <body>-tag when putting the code into the
document within the iframe. The code can be written
everywhere in the document - but in the document that is
opened within the iframe.


If it still doesn't work:

Try to change
document.scrollBy(x,y);
into
I1.document.scrollBy(x,y);
or
parent.I1.document.scrollBy(x,y);

Now the code to be in the document where the iframe is
defined.


Else, I don't know if the iframe should react to a link or
be shown when the site was opened. There would be two
different methods to handle it:

1)
If the site in the iframe should shown when the "main
page" is opened:
Add
a) <body onload=javascript:autoScroll()> [as above]
if the code is within this document.
b) <body onload=javascript:parent.I1.autoscroll()>
if the code is in the document shown in the frame.

2)
If the iframe should react to a clicked link:
The link:
<a href=javascript:change()>Link</a>
The script modification: Add
I1.document.href="url";
before the other two lines. (url = the page that should be
shown).


If none of this is working, you could send my an URL or an
email (change "spam" into "prog" to get my real Email
adress) that I can try it myself and I could send you the
result.

Yours sincerely
maak
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top