Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / JavaScript / December 2004



Tip: Looking for answers? Try searching our database.

using scrollBy in conjunction with frames

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
your name here - 30 Dec 2004 21:02 GMT
I've been trying to get the scrollby javascript feature to scroll
through frames. My end goal is to make my own scroll buttons to use
for navigation through the frame but I figured I would start simple.
I would load a frameset and just move the correct frame by 100 pixels
right and 100 pixels down.  Here is the code I am using:

<html>
<script TYPE="text/javascript">
function scrollme()
{parent.frames[1].scrollBy(100,100)}
</script>

<FRAMESET onload="scrollme();" COLS="300,300,300">
<frame src = http://www.yahoo.com name="yahoo">
<frame src = http://www.google.com name="google">
<frame src = http://www.cnn.com name="cnn">
</frameset>
</html>

The line that really matters is of course
{parent.frames[1].scrollBy(100,100)} and I've seen (and tried) this
written many ways.  It's got to be a syntax issue.  I've tried:

parent.frames.yahoo.scrollBy(100,100)
parent.frames.yahoo.window.scrollBy(100,100)
parent.frames[yahoo].window.scrollBy(100,100)

and more variants. I though maybe the function wasn't running so I
replaced my frames line with alert('Test!') and the msgbox came up.
Any ideas?

Sara
mscir - 30 Dec 2004 22:12 GMT
> The line that really matters is of course
> {parent.frames[1].scrollBy(100,100)} and I've seen (and tried) this
[quoted text clipped - 3 lines]
> parent.frames.yahoo.window.scrollBy(100,100)
> parent.frames[yahoo].window.scrollBy(100,100)
<snip>

How about:

top.framename.scrollBy(100,100);
top.frames[1].scrollBy(100,100);
Ivo - 30 Dec 2004 22:50 GMT
> <html>
> <script TYPE="text/javascript">
[quoted text clipped - 8 lines]
> </frameset>
> </html>

Cross-domain security measures prevent you from performing any action on
documents that are not from the very same domain as the document containing
the script. See for more info for example <
http://www.mozilla.org/projects/security/components/same-origin.html >.
There is no workaround. If your page resides on Google, the above will work
because parent.frames[1] will contain a document from the same domain.
Otherwise, wait till your page shows up in their cache, and then try
again...
--
Ivo
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.