Javascript problem

They have: 11 posts

Joined: Nov 1999

I'm creating a small dictionary for the same pages that I had a problem with yesterday (thanks to both vulken and lloyd for the help by the way...) now I want to open a certain html-file in a new window, and thought this was a good way to do it... a problem is that when the users dont use the close window button, they will get up to 41 windows opened... and I doubt they want that

So when the mainpage unloads, I want the other windows to close automaticly. I want to do this with a for-statement, but I dont get it to work... its the msg+i.close(); that is the problem of course... can someone please tell me how Im supposed to write the statements in the for-statement (*phew* ) ?

This is how I call the functions in the body:

code:

<p onClick="winopen(1); return true;">Absorberad dos</p>
.
.
.
<p onClick="winopen(41); return true;">Undantaget kolli</p>[/code]

-----

This is the javascript in the head of the document:

code:
function winopen(z) {
	m = "msg" + z;
	sida = "ord/" + z + ".htm";
	wind = "win" + z;
	m=open(sida,wind,"width=300,height=200");
	}


function closewin() {
	for (var i = 0; i < 42; i++) {
		msg[i].close();
		}
	}[/code]


------------------
./mdk

[This message has been edited by mdk (edited 25 November 1999).]

[This message has been edited by mdk (edited 25 November 1999).] 

./mdk

They have: 5,633 posts

Joined: Jan 1970

Your code looks like it should work. Best thing to do is give us a URL so we can check it out further.

------------------
http://go.to/hass

They have: 11 posts

Joined: Nov 1999

Ok... managed to get both telnet and ftp access (after 6 months they actually starts to trust me - amazing! )

so now the page is on:
http://www.carlsberg.nu/mdk/index.htm

its totally IE5 at the moment (should work in ie4 too though), but not very well in Netrape...

To explain a bit... the "links" on the page is different words in a dictionary... the four input boxes is just there for debugging, so to speak

The first word uses its own external openwin() function, but I of course want them all to use the same function... the reason the first word ("Absorberad dos") has its own, is that the for-statement works with that windows, but not with the others...

I changed the for-statement a bit... now it almost works anyway...

------------------
./mdk

./mdk

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.