I am trying to write a script that will allow a window to create multiple popup windows and keep a reference to each popup window by populating an array. Then at anytime I want to access one of the child windows I can by finding it in the array and using that window object.
To make sure I can do this I made this script below which opens a page with some open window links and close window links. I should be able to open both windows and close both windows using the appropriate window objects from the array.
I have two problems with this script:
IE5.x gives me an “Access is denied” error on any line that tries to access the name property of a window. Why? I should be able to access this right?
Netscape will process the openWindow function just fine but bombs using the closeWindowByName() function. It seems to bomb on “if(newWindowsArray[i].name==winName).” I think it has to do with the name property of the window object again.
Any Help or ideas? The HTML for the document including the script is listed below
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”>
//the new window object handle
var newWindowsArray = new Array();
function openWindow(winURL, winName, winFeatures)
newWindow = window.open(winURL, winName, winFeatures);
newWindowsArray[newWindowsArray.length] = newWindow;
for(i=0; i<newWindowsArray.length; i++)