document.onmouseup=showSelect;
注意一下大小写

解决方案 »

  1.   

    <html>
    <head>
    <title></title>
    <script language=JavaScript1.2>
    function showSelect(){
    document.forms[0].selectedText.value=document.selection.createRange().text
    }
    document.onmouseup=showSelect
    </script>
    </head>
    <body>
    <br>
    &Ntilde;&iexcl;&Ouml;&ETH;&Ograve;&raquo;&ETH;&copy;&Icirc;&Auml;×&Ouml;
    <hr>
    <p>
    asdggffhklestklsjgkldmfhlksepotkgpoaerasdgaasdgdfhgjygulkgy
    </p>
    <br>
    <form>
    <input type="edit" name="selectedText">
    </form>
    </body>
    </html>
      

  2.   

    <html>
    <head>
    <title></title>
    <script language=JavaScript1.2>
    function showSelect(){
    document.forms[0].selectedText.value=document.selection.createRange().text
    }
    document.onmouseup=showSelect
    </script>
    </head>
    <body>
    <br>
    选中一些文字
    <hr>
    <p>
    asdggffhklestklsjgkldmfhlksepotkgpoaerasdgaasdgdfhgjygulkgy
    </p>
    <br>
    <form>
    <input type="edit" name="selectedText">
    </form>
    </body>
    </html>
      

  3.   

    哦,但是我在书上看到document.getselect()方法,它上面说可以直接使用的还有我有个笔误document.Events(EVENT.MOUSEUP)应作document.captureEvents(EVENT.MOUSEUP)大小写javascript倒是不敏感的