---
title: "多项选择脚本"
author: "morle"
date: "2008-05-25T22:15:52Z"
tags: []
slug: "untitled"
draft: false
lastmod: "2008-05-25T22:15:52Z"
id: 196776
url: "https://morle.iteye.com/blog/196776"
---

发表于：2006年10月26日 10时32分57秒本文链接：http://user.qzone.qq.com/183481361/blog/31

![](http://imgcache.qq.com/ac/qzone_v4/b.gif)

多项选择脚本

![](http://imgcache.qq.com/ac/qzone_v4/b.gif)&lt;script LANGUAGE="javascript"&gt;  
function SelectOK()  
{  
if (trim(document.Form1.Bjbh.value) == "" )  
{  
alert("请先确定一个班级！");  
document.Form1.Bjbh.focus();  
return(false);  
}  
   try{  
    
   var bjbhValue = "";  
   var bjbhName = "";  
   var bjbhList = document.all("Bjbh");  
   var bjbhListLen = bjbhList.options.length;  
    
   for (i=1;i&lt;=8;i++)  
   {  
if(bjbhList.options(i).selected){  
bjbhValue = bjbhValue + bjbhList.options(i).value + ",";  
bjbhName = bjbhName + bjbhList.options(i).text + ",";  
}  
   }  
    
   bjbhValue = bjbhValue.substr(0,bjbhValue.length-1);  
   bjbhName = bjbhName.substr(0,bjbhName.length-1);  
    
   //alert(trim(bjbhValue));  
   //alert(trim(bjbhName));  
    
   window.opener.window.document.all(document.Form1.UpdateBH.value).value = trim(bjbhValue);  
   window.opener.window.document.all(document.Form1.UpdateXM.value).value = trim(bjbhName);  
    
   window.close();  
   }  
   catch(exception){  
   window.close();  
   }  
}  
&lt;/script&gt;