[Javascript] Problem with window.location.replace() or window.open()

Callista Chuah callista at simecity.com
Thu May 10 04:01:48 CDT 2001


Hi, I'm trying to get values from one window to another window.
Basically, I have 2 window containing a form each. What I need to do
is to assign values from window2 into window1. Sounds easy right,
however, before I get assign the value, I need to replace window 1
with another document/same document with extra parameter. This is the
function in window2 that was suppose to trigger the assignment; it's
invoked by an onclick event.

	function replace() {
		opener.location.replace("page1.html", opener.name);
		opener.document.forms[0].field.value = document.forms[0].rep.value;
	}

What actually happened when this function executes is window1 gets
replaced with "page1.html" but the assignment did not happen. What I
thought it was suppose to do was window1 gets replaced "page1.html"
and the input 'field' is assigned to the value of 'rep'.

What is wrong with my code. I've tried it with both Netscape and IE
and they both do not work. Preferably, I'd like it to work in IE at
the least.

I have a sample of these pages at
http://www.geocities.com/callista_hl_chuah/page1.html.

Someone help!

Callista





More information about the Javascript mailing list