By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,940 Members | 1,328 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,940 IT Pros & Developers. It's quick & easy.

Scrolling iframes

TheServant
Expert 100+
P: 1,168
Hi guys,
I don't want to use iframes, but it is really the principle that I am going with. I want to have a frame with another website in and basically show a pre-determined part of that page (via scrolling). I have been trying all night to get a simple script going and I was wondering what I am doing wrong. Here is my code:
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2.     function scroller() {
  3.         document.getElementById('myiframe').scroll(100,0);
  4.     }
  5. </script>
  6. <body onload="scroller()">
  7.     <iframe id="myiframe" scrolling="yes" height="500px" width="1000px" src="http://mytarget.com/"></iframe>
  8. </body>
Mar 8 '09 #1
Share this Question
Share on Google+
2 Replies


gits
Expert Mod 5K+
P: 5,390
in case the page that is loaded into the iframe is not from your domain you cannot control it by a script due to the XSS (cross-site-scripting) security restrictions ... have a look here
Mar 9 '09 #2

TheServant
Expert 100+
P: 1,168
THanks mate. I managed to do a work around with some CSS magic ;)
Mar 9 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.