Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6919539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:00:13+00:00 2026-05-27T10:00:13+00:00

I have two documents – main.html (parent document) and enterKey.html (child document) . Within

  • 0

I have two documents – main.html (parent document) and enterKey.html (child document).

Within main.html

<script>
...
</script>
<iframe id="key" src="enterKey.html"></iframe>

Within enterKey.html:

<input id="sbox" type="text">

I am trying to access the value entered in sbox for use in main.html. But because the user will be continuously updating sbox I need for the updates to be reflected in main.html.

For example if the user types into sbox “hello worlx” then corrects it a second later to “hello world” then the change must be reflected immediately in the parent document.

How can this be achieved?

I’ve been looking at using document.getElementById('key').contentWindow.sbox but don’t know how to use it in the context of my example.

Many thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:00:14+00:00Added an answer on May 27, 2026 at 10:00 am

    I think the best approach would be to set the onchange function on the field and they you can access elements on the parent page with:

    parent.document.getElementById("id")
    

    Example:

    In the enterKey.html you would set the onchange for your text field by:

    <input id="sbox" type="text" onChange="enterKeyFunc()">
    

    Then also in enterKey.html you would have a function called enterKeyFunc() or something that would look kinda like this:

    function enterKeyFunc()
    {
        parent.document.getElementById("mainHTMLFieldId").value = document.getElementById("sbox").value;
    }
    

    Then in main.html make sure that the field you wanted to keep synced has an id of “mainHTMLFieldID” and that should do it. Let me know if you have any other questions.

    Edit again:

    I think if you want to set a variable in the parent change the above js from

    parent.document.getElementById("mainHTMLFieldId").value = document.getElementById("sbox").value;
    

    to

    parent.globalVariableName = document.getElementById("sbox").value;
    

    This of course would only work if the variable you are trying to set is a global variable on the parent page. I haven’t done this for a long time personally but I believe this can be done.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have two documents that both have allot of properties. One document is
I have these two xml documents: XML 1: <outer> <foo> <foo-child name=fA special=true> content
I have to merge two xml documents using xslt 1.0. Each xml document has
I have two documents both are similar but I need to find an elegant
Suppose I have two documents that are identical except the lines are shuffled. Is
I have a loop that calculates the similarity between two documents. It collects all
I have used two GUIDs to open the folders My Computer and My Documents
I have several A4 PDF documents which I would like (two into one) glue
We have two Tables: Document: id, title, document_type_id, showon_id DocumentType: id, name Relationship: DocumentType
this is my situation: I have two org.w3c.dom.Document created from two xml files. What

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.