How to get the values in the opening window?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • deararuns
    New Member
    • Apr 2008
    • 1

    How to get the values in the opening window?

    i hav a window wit a button and text box..
    Then am opening a new window...
    suppose if i type somethin in a first window's text box.. and click the button..
    the value typed in the text box shoult appear in the opening window...
    Is it possible

    <html>
    <body>
    <script type = "text/javascript">
    function fun1 ( )
    {
    var i = document.getEle mentById("text1 ").value;
    newWindow = open ( "test.html ", "Window");
    newWindow.docum ent.writeln("<i nput type = 'button' name = 'button1' value = 'click'>");
    newWindow.docum ent.writeln("<i nput type = 'text' id = 'text1' name = 'txt1'>");

    }
    </script>
    <form name = "form">

    <input type = "button" name = "but1" value = "click" onclick = "fun1 ( )">

    <input type = "text" id = "text1" name = "text1" >

    </form>
    </body>
    </html>
  • pronerd
    Recognized Expert Contributor
    • Nov 2006
    • 392

    #2
    Originally posted by deararuns
    suppose if i type somethin in a first window's text box.. and click the button.. the value typed in the text box shoult appear in the opening window...
    Is it possible
    Yes.


    [HTML]
    <html>
    <body>
    <script type = "text/javascript">
    function fun1 ( )
    {
    var i = document.getEle mentById("text1 ").value;
    newWindow = open ( "test.html ", "Window");
    newWindow.docum ent.writeln("<i nput type = 'button' name = 'button1' value = 'click'>");
    newWindow.docum ent.writeln("<i nput type = 'text' id = 'text1' name = 'txt1' value='"+i+"' >");

    }
    </script>
    <form name = "form">

    <input type = "button" name = "but1" value = "click" onclick = "fun1 ( )">

    <input type = "text" id = "text1" name = "text1" >

    </form>
    </body>
    </html>[/HTML]

    Comment

    Working...