不好意思发错地方了,我指的是javascript

解决方案 »

  1.   

    这样吗?<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>无标题文档</title>
    </head>
    <script>
    function selectsed()
    {
    alert(document.getElementById("test").value);
    }
    </script>
    <body>
    <form name="form1" method="post" action="">
      <textarea name="textarea" id="test">fsdfds</textarea>
      <input type="button" onclick="selectsed()">
    </form>
    </body>
    </html>
      

  2.   

    找到答案了,分就给楼上的吧正确答案:
    <script language="javascript">
    function A(txt)
    {
      if(txt.selectionStart)//ff
      {
        alert(txt.value.substr(txt.selectionStart,txt.selectionEnd-txt.selectionStart))
      }
      else alert(document.selection.createRange().text);
    }
    </script>
    <input type='text' onmouseup="A(this)" value="abcdefghijklmn"/>