<a href=# onmousemove=selectMe()>aaaaaaaaaaaaaaaaaaaaa</a>
<a href=# onmousemove=selectMe()>bbbbbbbbbbbbbbbbbbbb</a>
<a href=# onmousemove=selectMe()>vvvvvvvvvvvvvvvvvvvv</a>
<a href=# onmousemove=selectMe()>ccccccccccccccccccccc</a>
<a href=# onmousemove=selectMe()>ddddddddddddddddddddd</a><script>
    function selectMe() {
    var r=document.body.createTextRange();
    r.moveToPoint(window.event.x, window.event.y);
    r.expand("word");
    r.select();
    }
</script>

解决方案 »

  1.   

    yeefly(Web开发版) 的方法不错
      

  2.   

    r.expand("word");这句能不能改?
    我现在是可以选中了,但只选中了一部分,如链接的文字是aaa.exe,则只选中了exe??
    怎么办?
      

  3.   

    <a href="aaa.exe">aaa.exe</a>
    页面显示为:链接的aaa.exe我是想鼠标以上去时,将aaa.exe全部选中!
      

  4.   

    可改为 sentence  则每句最后需一个"."结尾
    <a href=# onmousemove=selectMe()>aaaaaaaaaaaaaaaaaaaaa.</a>
    <a href=# onmousemove=selectMe()>bbbbbbbbbbbbbbbbbbbb.</a>
    <a href=# onmousemove=selectMe()>ggg.exe.</a>
    <a href=# onmousemove=selectMe()>ccccccccccccccccccccc.</a>
    <a href=# onmousemove=selectMe()>ddddddddddddddddddddd.</a>
    <script>
        function selectMe() {
        var r=document.body.createTextRange();
        r.moveToPoint(window.event.x, window.event.y);
        r.expand("sentence");
        r.select();
        }
    </script>
      

  5.   

    难道没有选中页面中链接的函数吗?
    文本框<input>也有.select()方法,
    链接<a>为什么就没有呢?