PDA

View Full Version : PopUp


123456789
11-17-2004, 06:12 PM
How come this doesn't loop three times?

<html><head>
<script language="javascript" type="text/javascript">
function popup()
{
for (var i=0; i < 3; i++ )
{
window.open('http://www.google.com','name','height=400,width=500');
}
}
</script>
</head>
<body>

<a href="javascript:popup();">Generate!</a>
</body>
</html>

Jon Hanlon
11-17-2004, 06:48 PM
It does.
But you're creating the same window thrice.

for (var i=0; i < 3; i++ ) {
window.open('http://www.google.com','name' +i ,'height=400,width=500');
}


This will give each window a different name (name0, name1, name2).

123456789
11-17-2004, 08:20 PM
Thanks. It works now.