[Javascript] Passing Objects from one window to another in Javascript

Pramod Jain, INDENT pramod at indent.org
Fri Jul 5 13:25:57 CDT 2002


Sorry, another typo in previous message:  'this.openWind = open.Wind;'
should be 'this.openWind = openWind;'
Problem with passing objects still remains.

------------------
I am trying to access an object and I have tried two options, both have not
worked.  Would appreciate help
============================================
Option 1.  I get "Permission Denied":

In caller window:

-------------
function Object1()
{
	this.phr = "abc";
	this.openWind = openWind;
	function openWind() {
		var newwin = window.open("ab.htm","");
	}
}
obj1 = new Object1();
<body>
	<input type=button onClick="obj1.openWind()">
</body>
-------------

In the called window:


function init(){
{
	alert(opener.obj1.phr);
}

<body onLoad="init()">

</body>


===========================================
Option 2:  I get "object does not support this property or method
In Caller window:
function Object1()
{
	this.phr = "abc";
	this.openWind = openWind;
	function openWind() {
		window.showModalDialog("ab.htm", this);
	}
}
obj1 = new Object1();
<body>
	<input type=button onClick="obj1.openWind()">
</body>
-----------------

In the called window:


function init(){
{
	alert(dialogArguments.obj1.phr);
}

<body onLoad="init()">

</body>






More information about the Javascript mailing list