function addt(){
var selVal = document.all.T5.value;
if(selVal == ""){
   alert("没有选择");
   return;
}
document.all.S1.value = document.all.S1.value + "\n" +selVal;
}
function delt(){
  document.all.S1.value = "";
}

解决方案 »

  1.   

    sorry 看错了var sel = document.all.T5;
    var selVal = sel.options[sel.selectedIndex].innerText; 
      

  2.   

    这个应该没有问题了,呵呵,上面两个是我想的,没有验证O(∩_∩)O
    <html>
    <head>
    <script>
    function addt(){ 
    var sel = document.all.T5; 
    if(sel.selectedIndex==-1)

      alert("没有选择"); 
      return; 
    }
    var selVal = sel.options[sel.selectedIndex].innerText;  
    document.all.S1.value = document.all.S1.value + "\n" +selVal; 

    function delt(){ 
      document.all.S1.value = ""; 
    }
    </script>
    </head>
    <body>
    <table cellpadding="0" cellspacing="0" width="461" height="108"> 
    <tr> 
    <td valign="top" width="173"> <select size="7" id=T5 name="T5"> 
    <option>11111111 </option> 
    <option>22222222 </option> 
    <option>33333333 </option> 
    <option>44444444 </option> 
    <option>55555555 </option> 
    <option>66666666 </option> 
    <option>77777777 </option> 
    <option>88888888 </option> 
    <option>99999999 </option> 
    </select> </td> 
    <td valign="top" height="108"> 
    <input type="button" value="选择" name="B1"  onclick="addt()"> <p> 
    <input type="button" value="取消" name="B2" onclick="delt()"> </td> 
    <td valign="top" width="248"> 
    <textarea rows="8" name="S1" cols="20" id=MemoBox> </textarea> </td> 
    </tr> 
    </table>
    </body>
      

  3.   

    4)文本区所选的内容可以通过选择,点"取消",删除. 这个用<select>来做
    用文本就算了
      

  4.   

    谢谢,majianan!
    但是选择到文本区后,第一行是空白的,这么奇怪的??
      

  5.   


    <SCRIPT LANGUAGE="JavaScript">
    function addt()
    {
    var t5 = document.getElementById("T5")
    var s1 = document.getElementById("MemoBox")
    if(t5.selectedIndex>-1)
    s1.add(new Option(t5.options[t5.selectedIndex].text))
    else
    alert("没有选择");
    }
    function delt()
    {
    var s1 = document.getElementById("MemoBox")
    if(s1.selectedIndex>-1)
    s1.removeChild(s1.options[s1.selectedIndex])
    }
    </SCRIPT>
    <table cellpadding="0" cellspacing="0" width="461" height="108"> 
    <tr> 
    <td valign="top" width="173">
    <select size="7" id=T5 name="T5"> 
    <option>11111111 </option> 
    <option>22222222 </option> 
    <option>33333333 </option> 
    <option>44444444 </option> 
    <option>55555555 </option> 
    <option>66666666 </option> 
    <option>77777777 </option> 
    <option>88888888 </option> 
    <option>99999999 </option> 
    </select> </td> 
    <td valign="top" height="108"> 
    <input type="button" value="选择" name="B1"  onclick="addt()"> <p> 
    <input type="button" value="取消" name="B2"  onclick="delt()"> </td> 
    <td valign="top" width="248"> 
    <select size=7 name="S1" id=MemoBox style="width:100%"></select> </td> 
    </tr> 
    </table> 
      

  6.   


    把下面这句
    document.all.S1.value = document.all.S1.value + "\n" +selVal; 
    改成
    document.all.S1.value = document.all.S1.value  +selVal+ "\n"; 
    就可以了