Yo tim, loop through the options array and find out which one is
selected.  Append selected ones to a variable and pass it back to opener
window. 

<script language="JavaScript" type="text/javascript"> function popit()
 
{
 
 var selObj = document.getElementById('select1');
 var selObj2 = document.getElementById('select2');
 var selIndex = selObj.selectedIndex;
 var selIndex2 = selObj2.selectedIndex;
 var temp="";

 for(i=0; i < selObj.options.length; i++){
        if(selObj.options[i].selected)
                temp+=innerHTML=selObj.options[i].value +',';
 
 }
opener.document.getElementById("texta").innerHTML=temp;
 
opener.document.getElementById("textb").innerHTML=selObj2.options[selInd
ex2].value;
 //alert(selObj.options[selIndex].value);
}
</script>

-----Original Message-----
From: Tim Do [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 03, 2006 12:40 PM
To: CF-Talk
Subject: OT: js help

Hi, I'm trying to passing values from a popup back to the parent window.
In the popup window, I have a select box (multiple).  I want to pass the
selected items back to the parent window but it is only passing back the
first value select not all the values selected in the drop down.  Here
is what I have:
 
<script language="JavaScript" type="text/javascript">
function popit()
 
{
 
 var selObj = document.getElementById('select1');
 var selObj2 = document.getElementById('select2');
 var selIndex = selObj.selectedIndex;
 var selIndex2 = selObj2.selectedIndex;
 
opener.document.getElementById("texta").innerHTML=selObj.options[selInde
x].value;
 
opener.document.getElementById("textb").innerHTML=selObj2.options[selInd
ex2].value; 
 //alert(selObj.options[selIndex].value);
}
</script>
 
<form action="pop2.cfm" method="post">
 
<select name="select1" multiple size="3">
 <option value="1">1
 <option value="2">2
 <option value="3">3
</select> 
<br>
<select name="select2">
 <option value="a">a
 <option value="b">b
 <option value="c">c
</select>
 
<input type="button" value="submit" name="submit" onclick="popit();">
 
</form>
 
 
Thanks!
 




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:234147
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to