By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,473 Members | 1,274 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,473 IT Pros & Developers. It's quick & easy.

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

P: n/a
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.value = text.

<HTML>
<SCRIPT TYPE='text/javascript' LANGUAGE='Javascript'>
function foo(text) {opener.document.myForm.URL.value = text;}
</SCRIPT>

<BODY> <Form>
<input type='button' value='Fill Text' onclick='foo("Hello 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

Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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" <so****@hotmail.com>
wrote:
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.value = text.

<HTML>
<SCRIPT TYPE='text/javascript' LANGUAGE='Javascript'>
function foo(text) {opener.document.myForm.URL.value = text;}
</SCRIPT>

<BODY> <Form>
<input type='button' value='Fill Text' onclick='foo("Hello 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


Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.