Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-27-2003, 03:30 PM   PM User | #1
safalkishore
New Coder

 
Join Date: Oct 2002
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
safalkishore is an unknown quantity at this point
multidimensional array problem

hi all
i am facing a problem with multidimension array while i try and access the same from a popup window and modify the actual array in the parent window.

This is what i am trying
1)I have an array in the main window
2)Onclick on a link i open a popup window
3)The popup window adds new values to the array in the parent window
4)Once the addition is done the popup window is closed
5)Then again i try and open the popup window to add more values

This is when an error throws up - "The Callee is not avaiable and disappeared-All connections invalid-Did not execute"

ie although the popup window has modified the array in the main window it fails to access the newly added array item

The main window shows the new added value though

Any solutions ????

Check below for code

Main Window

<SCRIPT LANGUAGE=javascript>
<!--
var tempArray = new Array();
for(i=0;i<2;i++)
tempArray[i]=new Array()

tempArray[0][0]="AAA"
tempArray[0][1]="ZEN2"
tempArray[1][0]="BBB"
tempArray[1][1]="ZEN1"

function winOpen()
{
alert(tempArray.length)
//alert(tempArray)
for(i=0;i<tempArray.length;i++)
{
alert(tempArray[i][0])
alert(tempArray[i][1])
}

oWin = window.open("popup.htm")
}
//-->
</SCRIPT>


PopUP Window

<SCRIPT LANGUAGE=javascript>
onload=init();
<!--
function init()
{
HeadLen=window.opener.tempArray.length;

var Headingarr = new Array();
for(i=0;i<HeadLen;i++)
Headingarr[i]=new Array()

alert(window.opener.tempArray.length)

for(i=0;i<HeadLen;i++)
{
alert(window.opener.tempArray[i][0])
alert(window.opener.tempArray[i][1])
}


for(i=0;i<HeadLen;i++)
{
Headingarr[i][0]=window.opener.tempArray[i][0];
Headingarr[i][1]=window.opener.tempArray[i][1];
}

//alert(Headingarr)
//window.opener.tempArray[window.opener.tempArray.length]=window.opener.tempArray.length;

val=window.opener.tempArray.length
//alert(val)
window.opener.tempArray[val]=new Array()
window.opener.tempArray[val][0] = "CCC"
window.opener.tempArray[val][1] = "ZEN3";

//alert(window.opener.tempArray)
var Headingarr = null;

self.close();
}
//-->
</SCRIPT>
safalkishore is offline   Reply With Quote
Old 02-27-2003, 10:29 PM   PM User | #2
beetle
Senior Coder

 
Join Date: Aug 2002
Posts: 3,467
Thanks: 0
Thanked 0 Times in 0 Posts
beetle has a little shameless behaviour in the past
Exactly what are you trying to accomplish with all this?
__________________
My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
“Minds are like parachutes. They don't work unless they are open”
“Maturity is simply knowing when to not be immature”
beetle is offline   Reply With Quote
Old 03-01-2003, 03:27 PM   PM User | #3
Mr J
Senior Coder

 
Join Date: Aug 2002
Location: UK
Posts: 2,789
Thanks: 2
Thanked 14 Times in 14 Posts
Mr J is on a distinguished road
Not 100% here but if you put


function window.onunload(){
opener.oWin=null;
}

in the popup page it might work

Its a case of the opener not being told that the child has closed so when you try to re open it as far as the opener is concerned it is open but it isn't if you know what I mean.
Mr J is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:30 PM.


Advertisement
Log in to turn off these ads.