Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

popup window wouldn't work

Status
Not open for further replies.

bench

Technical User
Jan 5, 2001
17
0
0
US
Hi
can anyone show me how to open multiple popup window
using myWin.open() in both IE5&N4. This is how I want
it to work. I have a select box which will allow my user
to select multiple sites. After the selection,
I want to popup those sites base upon their preference.
However, when i select, let say 2 sites, my program
will popup six sites which is the same amount of sites
in my select box and that's not what i want.

This is the code i been working with:


<html>
<head><title>Assignment#5</title>
Code:
<script language=&quot;JavaScript&quot;>
<!--

function go()
{       
        var myCars=window.document.myForm.mySites
        
        for (var i=0 ; i < myCars.length ; i++)
        {

            if (myCars.options[i].selected) 
       URL= &quot;[URL unfurl="true"]http://&quot;;+myCars.options[/URL][i].value;

var myWind=open(URL,'goCars','height=400,width=400,toolbar=no')
  myWind.focus()
        
  }
}

//-->
</script>
</head>
<body bgColor=lightblue>
<form name='myForm'>

<select name='mySites' multiple size=5 >
<option value=' BMW </option>
<option value=' Volkswagen </option>
<option value=' Ford </option>
<option value=' Honda </option>
<option value=' Volvo </option>
</select>
<br>
<input type=button value='show selected' onclick='go()'>
</form>
</body>

</html>
 
try asking if .selected == true

not positive on that one, but it's worth a shot. (=
 
I tried your suggestion, but this time it only open one window
when i select 2 window.
Code:
function go()
{
        var myCars=window.document.myForm.mySites
        var URL;
        for (var i=0 ; i < myCars.length ; i++)
        {

            if (myCars.options[i].selected==true)
               

       URL= &quot;[URL unfurl="true"]http://&quot;+myCars.options[/URL][i].value;

       var myWind=open(URL,'goCars','height=400,width=400,toolbar=no')
  myWind.focus()
}

}
 
I wonder if you giving each window the same ID could be causing the problem???

try dynamically creating an id for each like

windowID = 'goCars'+i
(URL,windowID,'height=400,width=400,toolbar=no')

again, not sure... but it doesn't look like anyone else is bursting with suggestions. :)
 
I tried your suggestion, but it only open one window when
I select two.
Is there a way I can stop the loop when the user say, select 2 sites
from my select box.
I think that's the problem I'm having.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top