<select name="select1" multiple>
<option>123424323423</option>
<option>56782342423</option>
<option>98762342423</option>
<option>9876523423423</option>
<option>56782342423</option>
<option>98762342423</option>
<option>9876523423423</option>
</select>

解决方案 »

  1.   

    <select name="select1" multiple>
    <option>123424323423</option>
    <option>56782342423</option>
    <option>98762342423</option>
    <option>9876523423423</option>
    <option>56782342423</option>
    <option>98762342423</option>
    <option>9876523423423</option>
    </select>
    <input name="button1" type="button" value="config" onclick="show()">
    <script language=javascript>
    function show()
    {
    var objs=document.getElementById("select1").options
    str=""
    for(var i=0;i<objs.length;i++)
    {
    if(objs[i].selected)
    {
    str+=objs[i].text+"\r\n"
    }
    }
    alert(str)
    }
    </script>
      

  2.   

    <select multiple="true" id="textAr">
    <option>123424323423</option>
    <option>56782342423</option>
    <option>98762342423</option>
    <option>2342324</option>
    <option>3423424</option>
    <option>4554645646</option>
    </select>
    <script language="JavaScript">
    <!--
    var textAr = document.getElementById("textAr")
    var arrTextAr = textAr.options
    alert(arrTextAr.length)
    //-->
    </script>
    根据 arrTextAr.length 的长度 做相应的操作~
      

  3.   


    我不要select阿
    一定只能textarea的
      

  4.   

    <html>
    <head>
    <style type="text/css">
    </style>
    <META http-equiv="content-type" content="text/html; charset=shift_jis">
    <title>TEST</title>
    </head>
    <LINK rel="stylesheet" href="../css/table.css" type="text/css" id="_HPB_TABLE_CSS_ID_">
    <script type="text/javascript"> function start_fresh(){ var oV = 0;
    var nV = 0;
    var rng = document.getElementById("textAr").createTextRange();

    var r1 = document.selection.createRange();
    var r2 ; 
    oV = r1.boundingHeight;
    nV = r1.boundingHeight;
    if (r1.parentElement().name == "textAr"){
    while(oV == nV){
    r2 = r1.duplicate();
    r2.moveEnd("character",1);
    nV = r2.boundingHeight;
    if (oV == nV){
    r1.moveEnd("character",1);
    }
    }
    r1.select();
    }
    }
    </script>
    </head>
    <body bgcolor= "#ffffff">
    <form method="post" action="" name="FMlog">
    <table>
    <tr><td>
    <input type = button value = "Config" onclick = "start_fresh()">
    <input type = button value = "Config" onclick = "newHighlite( document.FMlog.textAr)">
    </td></tr>
    <tr><td>
    <textarea name = "textAr" rows = "5" cols = "100">
    123424323423
    56782342423
    98762342423
    9876523423423
    56782342423
    98762342423
    9876523423423
    </textarea>
    </td>
    </tr>
    </table>
    </form>
    </body>
    </html>
      

  5.   

    <html>
    <head>
    <style type="text/css">
    </style>
    <META http-equiv="content-type" content="text/html; charset=shift_jis">
    <title>TEST</title>
    </head>
    <LINK rel="stylesheet" href="../css/table.css" type="text/css" id="_HPB_TABLE_CSS_ID_">
    <script type="text/javascript"> function start_fresh(){ var oV = 0;
    var nV = 0;
    var rng = document.getElementById("textAr").createTextRange();

    var r1 = document.selection.createRange();
    var r2 ; 
    oV = r1.boundingHeight;
    nV = r1.boundingHeight;
    if (r1.parentElement().name == "textAr"){
    while(oV == nV){
    r2 = r1.duplicate();
    r2.moveEnd("character",1);
    nV = r2.boundingHeight;
    if (oV == nV){
    r1.moveEnd("character",1);
    }
    }
    r1.select();
    }
    oV = r1.boundingHeight;
    nV = r1.boundingHeight;
    if (r1.parentElement().name == "textAr"){
    while(oV == nV){
    r2 = r1.duplicate();
    r2.moveStart("character",-1);
    nV = r2.boundingHeight;
    if (oV == nV){
    r1.moveStart("character",-1);
    }
    }
    r1.select();
    }
    }
    </script>
    </head>
    <body bgcolor= "#ffffff">
    <form method="post" action="" name="FMlog">
    <table>
    <tr><td>
    <input type = button value = "Config" onclick = "start_fresh()">
    <input type = button value = "Config" onclick = "newHighlite( document.FMlog.textAr)">
    </td></tr>
    <tr><td>
    <textarea name = "textAr" rows = "5" cols = "100">
    123424323423
    56782342423
    98762342423
    9876523423423
    56782342423
    98762342423
    9876523423423
    </textarea>
    </td>
    </tr>
    </table>
    </form>
    </body>
    </html>