/    Sign up×
Community /Pin to ProfileBookmark

copying elements..

How can I copy elements from one iframe to another?
I have two Iframes and they are nested.
Ther outer Iframe is called main and the innner iframe is called sub.
I want to copy some input text values from sub to main.
Please help me

thanks

to post a comment
JavaScript

7 Comments(s)

Copy linkTweet thisAlerts:
@pyroJul 29.2003 — If I understand you correctly, something like this should work:

parent.document.formname.inputname.value = document.formname.inputname.value;
Copy linkTweet thisAlerts:
@miliauthorJul 29.2003 — thanks Pyro.

One more question: If I want to submit the form contained in my "sub" iframe from my outer "main" frame, will it work I

say

document.subform.submit(); from my outer Iframe?
Copy linkTweet thisAlerts:
@pyroJul 29.2003 — You would need to use something like this:

top.outeriframename.inneriframename.document.formname.submit();

Or you could try (though I'm not certain it will work)

self.inneriframename.document.formname.submit();

If you try the second method, let me know if it works.
Copy linkTweet thisAlerts:
@miliauthorJul 29.2003 — Thanks Pyro...I will have to try that tomorrow at work.I will let you know if that works.

Good Night ?
Copy linkTweet thisAlerts:
@pyroJul 29.2003 — Ok, sounds good...
Copy linkTweet thisAlerts:
@miliauthorJul 29.2003 — The second method works like a charm! Thanks Pyro
Copy linkTweet thisAlerts:
@pyroJul 29.2003 — Ok, add that to my mental list of things that will work... ? lol
×

Success!

Help @mili 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.6,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

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