Hier ein kleines Beispiel um einen iframe zu scrollen. Das Problem hier ist, daß die URL des iframes auf eine externe Resource verweist. Ein scrollBy() wird nicht ausgeführt. Der Workaround ist simpel und irgendwie “na ja” aber er funktioniert browserübergreifend.

Hier der Code für die darzustellende Seite:
 

<html>
<head>
<script>
var a;

   function scrollPage() 
   {
     a=frames['myframe'];
     status=a.scrollBy(0,230); //1.Parameter x, 2.Parameter y-Position
}
</script>
</head>
<body >
<h1>Test</h1>

<iframe src="iframe.html"  name="myframe" onload="scrollPage(this);" width=580 height=400>
</iframe>

</body>
</html>

Und hier der versteckte Frame (iframe.html)

<html>
<body>
<iframe id="frame" name="frame" scrolling="no" src="http://www.eineexterneurl.de/mit_getparametern?etc=usw" frameborder="0" width="580" height="650">Sorry, your browser doesn't support iframes.</iframe>
</body>
</html>
Werbung

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed