/    Sign up×
Community /Pin to ProfileBookmark

Iframe referencing problems

Hi,

I have a page with 2 iframes in (presumably at the same hierarchical level). I need to control iframe called “main” from the iframe called “menu’.

The code that I have so far is below with the lines that I think need changing highlighted in [B]bold[/B]:

<script language=”JavaScript”>

function scroller(xval)
{
[B]var i = main.document.body.scrollLeft;[/B]
var speed = 15;

if (i < xval)
{
while (i <= xval)
{
i+=speed;
[B]main.scrollTo(i, 0);[/B]
}
}
else
{
while (i >= xval)
{
i-=speed;
[B]main.scrollTo(i, 0);[/B]
}
}

}

</script>

Many thanks in advance

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@96turnerriApr 02.2004 — try...
[code=php]
<script language="JavaScript">

function scroller(xval)
{
var i = parent.frames[main].document.body.scrollLeft;
var speed = 15;

if (i < xval)
{
while (i <= xval)
{
i+=speed;
parent.frames[main].scrollTo(i, 0);
}
}
else
{
while (i >= xval)
{
i-=speed;
parent.frames[main].scrollTo(i, 0);
}
}
}

</script>[/code]
Copy linkTweet thisAlerts:
@doctorsrpauthorApr 02.2004 — thanks very much, it worked a treat
Copy linkTweet thisAlerts:
@96turnerriApr 02.2004 — no problem ?
×

Success!

Help @doctorsrp spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...