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

S

Song Zhang

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
 
D

Doug Turner

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top