Scrolling iFrame code not working
http://jsfiddle.net/TQjgn/2/
Does anyone see the problem with it? (I am trying to make a scrolling iframe that stops when one m开发者_JS百科ouses over it) Oh, and this is in javascript.
Crossframe-Scripting is not possible when the two frames have different domains -> Security. That's why using jsfiddle.net you can't make the iframe scroll.
Check this: http://javascript.about.com/od/reference/a/frame3.htm
Now to answer your question: there is no solution or work around, you simply should check your website-design why there must be two frames from different domains that changes the url of the other one.
If you need that scrollbar why dont you use overflow property CSS overflow Property
Look into setInterval and setTimeout.
Your code will attempt to run to completion before ever accepting user input.
Iframe content is in a different domain so it can not interact with it due to the same origin policy.
onload event of iframe could fire before the onload event is registered.
You really should not do the do while for pausing time, there are better ways of doing it with setTimeout.
It looks like you are thinking of myIframe.mouseover as a value that will be either true or false depending on whether the mouse is over the element where it should be an event handler.
You need to learn about JavaScript events, e.g.
myIframe.onload = function() { /* something that makes it scroll */ }
myIframe.mouseover = function() { /* something that makes it stop */ }
精彩评论