how to fill some field in parent window from a child window

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Song Zhang

    how to fill some field in parent window from a child window

    I need to write asp/script/html code to fill the following function.
    1. When a page appA.mycom.com/aa.html (aa.html code shown below) is visited
    from my site, a user can click the button "Launch", which launches a new
    window with a page from a different domain, say appB.mycom.com/bb.html. In
    the form myForm of aa.html, there is a field called URL.

    <html> <body>

    <form name="myForm">
    <input type="button" value="Launch" onclick="window .open('bb.html' )">
    <input type="text" name="URL" value="Nothing Here Initially">
    </form>

    </body></html>

    2. At bb.html (code shown below), there is a button "Fill Text", once
    clicked, I want some text from bb.html to be filled in the URL field of
    myForm in aa.html via opener.document .myForm.URL.val ue = text.

    <HTML>
    <SCRIPT TYPE='text/javascript' LANGUAGE='Javas cript'>
    function foo(text) {opener.documen t.myForm.URL.va lue = text;}
    </SCRIPT>

    <BODY> <Form>
    <input type='button' value='Fill Text' onclick='foo("H ello world ")'>
    </Form> </BODY>
    </HTML>

    The problem is that when I clicked the button "Fill Text" on bb.html, I got
    an error: access denied. This reminds me sth fundamental. That is, do I have
    to implement this from server side? Thanks.

    _______________ _______________ _______________ _______________ _____
    Instant message during games with MSN Messenger 6.0. Download it now FREE!


  • Doug Turner

    #2
    Re: how to fill some field in parent window from a child window

    Well, I am too lazy to try this out ... but, I believe if put this
    javascript statement:

    document.domain = "mycom.com" ;

    in both the "opener" and the "opened" window, you will eliminate the
    access denied error.

    On Fri, 26 Sep 2003 10:58:15 -0400, "Song Zhang" <sozst1@hotmail .com>
    wrote:
    [color=blue]
    >I need to write asp/script/html code to fill the following function.
    >1. When a page appA.mycom.com/aa.html (aa.html code shown below) is visited
    >from my site, a user can click the button "Launch", which launches a new
    >window with a page from a different domain, say appB.mycom.com/bb.html. In
    >the form myForm of aa.html, there is a field called URL.
    >
    ><html> <body>
    >
    ><form name="myForm">
    ><input type="button" value="Launch" onclick="window .open('bb.html' )">
    ><input type="text" name="URL" value="Nothing Here Initially">
    ></form>
    >
    ></body></html>
    >
    >2. At bb.html (code shown below), there is a button "Fill Text", once
    >clicked, I want some text from bb.html to be filled in the URL field of
    >myForm in aa.html via opener.document .myForm.URL.val ue = text.
    >
    ><HTML>
    ><SCRIPT TYPE='text/javascript' LANGUAGE='Javas cript'>
    > function foo(text) {opener.documen t.myForm.URL.va lue = text;}
    ></SCRIPT>
    >
    ><BODY> <Form>
    ><input type='button' value='Fill Text' onclick='foo("H ello world ")'>
    ></Form> </BODY>
    ></HTML>
    >
    >The problem is that when I clicked the button "Fill Text" on bb.html, I got
    >an error: access denied. This reminds me sth fundamental. That is, do I have
    >to implement this from server side? Thanks.
    >
    >______________ _______________ _______________ _______________ ______
    >Instant message during games with MSN Messenger 6.0. Download it now FREE!
    >http://msnmessenger-download.com
    >[/color]

    Comment

    Working...