/    Sign up×
Community /Pin to ProfileBookmark

Frame javascript problem!

Here it is, i have a page that includes 3 frames, 2 vertically and 1 horizontally at the bottom. The two vertical ones will include text boxes. The bottom one will need a javascript function to call up information from the frames above and do mathamatical equations (Such as 65+34 or something).
Does anybody know how to do that?
?

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@buntineJan 28.2004 — One method is to use the inbuilt frames array.

[CODE]
var frame_one = top.frames[1];
var frame_two = top.frames[2];

var text_box_one = frame_one.document.getElementsByTagName("input")[0];
var text_box_two = frame_two.document.getElementsByTagName("input")[0];

alert(text_box_one.value + "n" + text_box_two.value);
[/CODE]


Note, you may have to edit the above code. It assumes the first occurance of the <input> element is the textbox.

Also, indexing starts at zero. So frames[1] is actually referring to the second frame on the page.

Regards,

Andrew Buntine.
×

Success!

Help @chriz 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 6.16,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...