Results 1 to 4 of 4

Thread: "Connecting" two pages

  1. #1
    Join Date
    Nov 2007
    Posts
    151
    Thanks
    67
    Thanked 0 Times in 0 Posts

    Default "Connecting" two pages

    Hi

    I have 2 pages: index.html, popup.html

    The page popup.html includes one button. The page index.html includes a text bbox.

    I want that by clicking on this button, it will print some text in a text box which I have in index.html.

    I thought about using window.opener or something like this, but I'm not sure yet.

    Any suggestions?

  2. #2
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    index.html:
    HTML Code:
    <input type="text" id="mytext" readonly="readonly"><input type="button" value="Open Popup.html" onclick="window.open('popup.html','mywin','height=150,width=300');">
    popup.html:
    HTML Code:
    <input type="button" value="Print some text on index's textbox" onclick="window.opener.document.getElementById('mytext').value='Perfect!';window.close();">
    Hope that helps.
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  3. The Following User Says Thank You to rangana For This Useful Post:

    d-machine (09-20-2008)

  4. #3
    Join Date
    Sep 2008
    Posts
    26
    Thanks
    2
    Thanked 4 Times in 4 Posts

    Default

    //EDIT Oops, too slow :-)

    Open a popup...
    Code:
    <script language="JavaScript"><!--
    myWindow = window.open('test.htm','Example','width=200,height=200');
    //--></script>
    adressing it...
    Code:
     <script language="JavaScript"><!--
    myWindow.document.getElementById('myinput').value="Foo";
    //--></script>
    some random textfield with the id...
    HTML Code:
    <input id="myinput" />

  5. The Following User Says Thank You to schorhr For This Useful Post:

    d-machine (09-20-2008)

  6. #4
    Join Date
    Nov 2007
    Posts
    151
    Thanks
    67
    Thanked 0 Times in 0 Posts

    Default

    Thank you both very very much !!!!!!!

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
  •