Opening Multiple Windows

Hello:

Hello Everybody:

I have a JavaScript that allows you to open 5 additional windows when you click on the button.
It works properly when using Mozilla, but when you use IE7, only 1 window pops
up not 5. I would appreciate the help!!!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">


<head>


<title>Open Multiple Windows</title>


<meta http-equiv="Content-type" content="text/html; charset=iso-8859-1" />


<meta http-equiv="Content-Language" content="en-us" />

<meta name="description" content="Wealthy List" />
<meta name="keywords" content="Wealthy List" />



<!-- the absolute pathname of this file is:            -->

<!-- C:\\MISCSUP2_10_17_8\\MISCSUP2\\Javascript_Demystified_Download_Working\\ -->
<!-- Ch_9_Page192.html -->
<!-- NOTE that the Authors download files have errors in that he forgot to -->
<!-- follow the format for making comments.  He forgot to put in the second dash -->
<!-- for the left comment format -->


<!-- this file was created on Saturday, 10/30/10:                                  -->
<!-- this file was updated on Saturday, 10/30/10:                                  -->
<!-- Note that this opens up 5 new windows using Mozilla, but only opens 1 window in IE7 -->

<script language="Javascript" type="text/javascript">
         
          
         
               <!--

var Win = Array();

function Launch() {
         for (i=0; i < 5;i++)
         { 
            Win[i] = window.open('', 'win'+i, 'width=50,height=50')
         }
      }


               -->

      </script>


</head>

   <body>



      <form action="http://www.jimkeogh.com" method="post">

         <p>

           <input name="WindowsGoneWild" 

            value="Windows Gone Wild" type="button" 

            onclick="Launch()"/>

         </p>

     </form>



     <noscript>
         <h1> JavaScript Required</h1>
      </noscript>

   </body>


</html>

It works fine for me in IE7. It’s slow, but it works fine.

But, why do you need to open 5 windows? One pop-up window is annoying, and having more than that would probably be a huge mistake with regard to user experience.

Also, you need to the new keyword in front of Array, so:

var Win = new Array();

Actually, it would be much better to use an array literal instead:

var Win = [];

Hello:

It still doesn’t work in IE! I am only trying to get this to work because it
is in a book that teaches you beginning JavaScript. I posted my latest attempt below:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">


<head>


<title>Open Multiple Windows</title>


<meta http-equiv="Content-type" content="text/html; charset=iso-8859-1" />


<meta http-equiv="Content-Language" content="en-us" />

<meta name="description" content="Wealthy List" />
<meta name="keywords" content="Wealthy List" />



<!-- the absolute pathname of this file is:            -->

<!-- C:\\MISCSUP2_10_17_8\\MISCSUP2\\Javascript_Demystified_Download_Working\\ -->
<!-- Ch_9_Page192.html -->
<!-- NOTE that the Authors download files have errors in that he forgot to -->
<!-- follow the format for making comments.  He forgot to put in the second dash -->
<!-- for the left comment format -->


<!-- this file was created on Saturday, 10/30/10:                                  -->
<!-- this file was updated on Saturday, 10/30/10:                                  -->
<!-- Note that this opens up 5 new windows using Mozilla, but only opens 1 window in IE7 -->

<script language="Javascript" type="text/javascript">
         
          
         

               <!--
var Win = [];


function Launch() {
         for (i=0; i < 5;i++)
         { 
            Win[i] = window.open('', 'win'+i, 'width=50,height=50')
         }
      }


               -->

      </script>


</head>

   <body>



      <form action="http://www.jimkeogh.com" method="post">

         <p>

           <input name="WindowsGoneWild" 

            value="Windows Gone Wild" type="button" 

            onclick="Launch()"/>

         </p>

     </form>



     <noscript>
         <h1> JavaScript Required</h1>
      </noscript>

   </body>


</html>

It works fine in IE for me, but only after I confirm that I want to “Allow [the] Blocked Content.” Do you see the “JavaScript Required” text at the bottom of the page?