日期:2014-05-18 浏览次数:20623 次
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE> New Document </TITLE>
  <META NAME="Generator" CONTENT="EditPlus">
  <META NAME="Author" CONTENT="">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">
 </HEAD>
 <BODY>
 <script>
function select(val){
    var txt=document.getElementById('txt');
    if(txt.value.length==0){
        txt.value=val;
    }
    else{
        if(txt.value.indexOf(val)>-1){
            alert('已选择此联系人');
        }
        else{
            txt.value+=","+val;
        }
    }
}
  </script>
 <table>
<tr>
<td>
选择联系人:<br>
  <select ondblclick='select(this.options[this.selectedIndex].text);' style='width:100px;height:100px;' multiple="multiple">
    <option text='A' value='1'>A</option>
       <option value="2">B</option>
       <option value="3">C</option>
       <option value="4">D</option>
       <option value="5">E</option>
       <option value="6">F</option>
  </select>
</td>
<td>
<input type='text' id='txt' />
</td>
</tr>
  </table>
 
 </BODY>
</HTML>
------解决方案--------------------
dropdownlist
------解决方案--------------------
借灰太狼,献花~哈哈
<script>
function select(val){
    var txt=document.getElementById('txt');
    if(txt.value.length==0){
        txt.value=val;
    }
    else{
        if(txt.value.indexOf(val)>-1){
            alert('已选择此联系人');
        }
        else{
            txt.value+=","+val;
        }
    }
}
function selecta(val){
    var txt=document.getElementById('txta');
    if(txt.value.length==0){
        txt.value=val;
    }
    else{
        if(txt.value.indexOf(val)>-1){
            //alert('已选择此联系人');
        }
        else{
            txt.value+=","+val;
        }
    }
}
  </script>
<table>
<tr>
<td>
选择联系人:<br>
  <select ondblclick='select(this.options[this.selectedIndex].text);selecta(this.options[this.selectedIndex].value);' style='width:100px;height:100px;' multiple="multiple">
<%  ds = Fy_SqlParameter.GeneralcategoryB("select Fy_Collectibles.CollectionID,Fy_Collectibles.CollectionUsersId,Fy_Users.NickName from Fy_Collectibles inner join Fy_Users on Fy_Collectibles.CollectionUsersId=Fy_Users.UsersId where Fy_Collectibles.UsersId=@GcParameters", "36", "Int");
    sl = ds.Tables[0].Rows.Count;
    for (int i = 0; i < sl; i++)
  { %>
<option value='<%=ds.Tables[0].Rows[i]["Colle