SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2000
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am trying to pass a value of a textbox from a popup back to the page that opened it. It works fine on IE but doesn't work on Netscape. Any help is greatly appreciated.

    Here is the page that opens the popup:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

    <html>
    <head>
    <title>Untitled</title>
    </head>


    <BODY>

    <center>
    <script language="Javascript">
    <!-- Begin
    function win() {
    OpenWin = window.open("pop01.htm","sub","left=370,top=100,height=150,width=350,toolbar=no,menubar=no,location=no,scrollbars=yes,resize=yes");

    }
    // End -->
    </script>

    <a href="Javascript:win()">Popup</a>

    <form name=yourform>
    <input type=text name=msg size=10 value="">
    <p>
    </form>
    </center>
    <p><center>

    </center><p>
    </body>



    </html>







    Here is the Popup page:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

    <html>

    <HEAD>

    <script language="JavaScript">
    <!-- Begin
    function passText(str) {
    window.opener.yourform.msg.value = str;
    window.close();
    }
    // End -->
    </script>

    </HEAD>

    <!-- STEP TWO: Copy this code into the BODY of your HTML document -->

    <BODY>

    <p align="left">
    <form name=myform>
    File Addressinput type="file"><br>
    Filename:
    <input type=text name=user size=10 value="">
    <input type=button value="Submit" onClick="passText(this.form.user.value);">
    </form>



    </body>
    </html>
    Noble Varughese
    President of DesiBoyz Network
    http://www.desiboyz.net

  2. #2
    JavaScript Guru (Big Ego) Arielladog's Avatar
    Join Date
    Jul 1999
    Location
    SC, USA
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey,

    Instead of using this:

    Code:
    window.opener.yourform.msg.value = str;
    Try using this:

    Code:
    window.opener.document.yourform.msg.value = str;
    aDog


Bookmarks

Posting Permissions

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