Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Question - How to access a field on parent

    Hi,

    I have the following:

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Capital</title>
    <script language="Javascript" type="text/javascript">
    <!--
    function btnSubmit1_onclick()
    {
    var s = document.getElementById("form1");
    s = s.text1;
    s = s.value;
    alert("Post data! " + s);
    }
    //-->
    </script>
    </head>
    <body>
    <form action="" method="POST" id="form1" >
    <p>When the checkbox is checked, you are prompted to enter a value</p>
    <input type='text' id='text1' value='enter amt' maxlength='10' tabindex='1' />
    <input type='button' id='btnSubmit1' value='Submit' onclick="btnSubmit1_onclick()" />
    </form>

    I want to put the value I get in a field on the page that opend this, how do I do that?

    Thanks
    Zack

  • #2
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up Here is what I came up with.

    function btnSubmit1_onclick()
    {
    var s = document.form2.text1.value;

    if(window.opener )
    {
    with(window.opener)
    {
    form1.testbox.value = s;
    }
    window.close();

    }
    else
    {
    // for DHTML
    top.document.form1.testbox.value = s;
    top.document.getElementById("dwindow").style.display="none";
    }
    }


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •