?
Solved

Iframe Scroll Position

Posted on 2005-05-06
15
Medium Priority
?
865 Views
Last Modified: 2012-06-27
Hey,

Attempting to set the scroll position of an iframe. Basically what is happening is that a Flash movie is bringing up an iframe and placing content within it. What I want to be able to do is set the iframe's scroll position based on which content it happens to be loading up. Been futzing with this without getting the iframe to show any sign of listening to my commancds with "scroll," "scrollTo," "scrollBy."

Little help?

Thanks.
0
Comment
Question by:AlexSilverman
  • 7
  • 6
14 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 13950152
window.frameName.document.elementId.scrollIntoView()
on IE should work
window.frameName.scrollTo(200,400)  or scrollBy
should work too
0
 

Author Comment

by:AlexSilverman
ID: 13959002
i tried scrollTo and scrollBy, but they weren't doing it for me. the code in the javascript call looks like this:

window.document.getElementById("myLayer").style.left = "75";
window.document.getElementById("myLayer").style.top = "145";
window.document.getElementById("myFrame").src = "<address>";
window.document.getElementById("myLayer").style.visibility = "visible";

tried: window.document.getElementById("myFrame").scrollTo(x,y);

made that call after putting the new source into the frame. need to cut out the "document.getElementById" part?
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 14023097
yes
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:AlexSilverman
ID: 14077944
Sorry for being slow in responding, been all over the place lately. I have the above code followed by this:

window.WorldFrame.scrollTo(25,25);

and that isn't getting the job done. does that need to be in some kind of other statement to hit after the page is loaded or something?
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 14081700
Is the iframe content from the same server as the rest?
If not forget it
0
 

Author Comment

by:AlexSilverman
ID: 14081716
no, reloading a different page...
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 14081797
Meaning another server or another page from the same server.

And yes you might want to do
setTimeout('window.WorldFrame.scrollTo(25,25)',1000)
or put it in the body onLoad of the page you are loading
0
 

Author Comment

by:AlexSilverman
ID: 14096323
Okay, so now i'm trying this:

function my_onload() {
alert("hit");
window.myFrame.scrollTo(25,25);
}

w/

</div>
<div id="myLayer" style="position:absolute; left:75; top:145; width:630; height:360; z-index:2; visibility: hidden;">
<iframe src="" onLoad="my_onload()" name="myFrame" id="myFrame" width="700" marginwidth="0" height="360" marginheight="0" scrolling="yes"></iframe>
</div>

and i'm getting the alert onLoad (for everything... a way to isolate that to the iframe's loading itself?), but it is spitting, "Error: Access is Denied" on the attempt to do ScrollTo... thoughts?
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 14100496
Is the page you are loading from your server, same server as the page that has the iframe???
I did not understand your reply.

And what do you mean by it alerts for everything
0
 

Author Comment

by:AlexSilverman
ID: 14113025
the alert in the "my_onload" function, meaning that "my_onload" is firing everytime a load completes would be my read on it. the iframe is loading a page from a different server.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 14113571
You cannot access an iframe with foreign content.
0
 

Author Comment

by:AlexSilverman
ID: 14113636
you can't move the scroll bar on an iframe that you load up unless you are serving it up from a local path?
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 1000 total points
ID: 14113865
As I already pointed out in
http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_21415666.html#14081700

If you have a frameset in the iframe and the frameset is yours then you can put the iframe in the dynamic part here:
http://www.dynamicdrive.com/dynamicindex2/iframe-scroller.htm
0
 
LVL 17

Expert Comment

by:Cem Türk
ID: 15697268
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup topic area:
    Accept: mplungjan

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

cem_turk
EE Cleanup Volunteer
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question