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 3 of 3
  1. #1
    New Coder
    Join Date
    Dec 2006
    Posts
    41
    Thanks
    6
    Thanked 0 Times in 0 Posts

    need help with this plz

    hey guyz....am tryin to populate parent window from the child window usin a href link...its like in parent window there is a textbox with hyperlink which needs to be populated by child window.....in the child window i perform a search and from the search results when i hit the href link in search results...the text in the child window should populate the parent window textbox....and puttin my parent and child window....can someone plz add what needs to be added to it....i did it my self but...evertyhin is workin fine....but when i hit the href in child window....it is populatin the parent window but not with the text i got in search results...i can see "text Field" in the parent window text box...am not sure what to add to this but plz help me by addin what is necessary to it.....

    this is parent window (test.html)
    <head>
    <script>
    function loadParent() {
    pWindow = opener.window;
    pWindow.document.getElementById("textField").value = "Text Field";
    pWindow.document.getElementById("contentArea").innerHTML = "Content from child window";
    }
    </script>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Travel Search</title>

    <link href="myCSS.css" rel="stylesheet" type="text/css" />
    </head>

    <body>
    <a href="ex.html" target="_blank">New window</a>
    <form>
    <input type="text" id="textField">
    </form>
    <div id="contentArea"></div>
    </body>
    this is child window (ex.html)
    <head>
    <script>
    function loadParent() {
    pWindow = opener.window;
    pWindow.document.getElementById("textField").value = "text Field";
    pWindow.document.getElementById("contentArea").innerHTML = "Content from child window";
    window.close()
    }
    </script>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    </head>

    <body>
    <table width="200" border="1">
    <tr>
    <td><a href="#" onclick="loadParent()">populate parent</a>#post.code#</td>
    </tr>
    </table>
    </body>
    so when i click the href the text which am seein in the parent window..i highlighted it with red color....so plz add what is necessary to the code guyz.....thanx....

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Try it this way

    test.html

    PHP Code:
    <HTML>
    <
    HEAD>
    <
    TITLE>Travel Search</TITLE>
    <
    link href="myCSS.css" rel="stylesheet" type="text/css" />
    </
    HEAD>
    <
    BODY>

    <
    a href="ex.htm" target="_blank" onclick="window.open(this.href);return false">New window</a>

    <
    form>
    <
    input type="text" id="textField">
    </
    form>
    <
    div id="contentArea"></div>
     
    </
    BODY>
    </
    HTML

    ex.html remains the same
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

  • #3
    New Coder
    Join Date
    Dec 2006
    Posts
    41
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Mr J View Post
    Try it this way

    test.html

    PHP Code:
    <HTML>
    <
    HEAD>
    <
    TITLE>Travel Search</TITLE>
    <
    link href="myCSS.css" rel="stylesheet" type="text/css" />
    </
    HEAD>
    <
    BODY>

    <
    a href="ex.htm" target="_blank" onclick="window.open(this.href);return false">New window</a>

    <
    form>
    <
    input type="text" id="textField">
    </
    form>
    <
    div id="contentArea"></div>
     
    </
    BODY>
    </
    HTML

    ex.html remains the same
    hey man...i tried what u told but...the problem is ....when i hit the href link it is populatin the parent field but it is populatin by the name "text Filed" i dont know y...but whenever i hit the href link am seein the word"text Field" in the parent text box.....can u plz tell me what is wrong


  •  

    Posting Permissions

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