<table border>
<tr><td onclick="a(this)">aaaa</td></tr>
<tr><td onclick="a(this)">bbbb</td></tr>
</table>
<script>
function a(o)
{
txt=window.document.body.createTextRange()
if(txt.findText(o.innerText))
{
 txt.moveStart("character",0);
  txt.scrollIntoView();
 txt.select();
}
}
</script>

解决方案 »

  1.   

    ms-help://MS.VSCC/MS.MSDNVS/DHTML/workshop/author/dhtml/reference/methods/select_0.htm
    INPUT type=button 
    INPUT type=checkbox 
    INPUT type=file 
    INPUT type=image 
    INPUT type=password 
    INPUT type=radio 
    INPUT type=reset 
    INPUT type=submit 
    INPUT type=text 
    TEXTAREA
      

  2.   

    ms-help://MS.VSCC/MS.MSDNVS/DHTML/workshop/author/dhtml/reference/methods/select_1.htm
    TextRange controlRange
    Sample:function TextRangeSelect() {
    var r = document.body.createTextRange();
    r.findText("text here");
    r.select();
    }
      

  3.   

    txt=window.document.body.createTextRange()
    我的表是放在DIV上面,请问DIV是否支持createTextRange()方法?
      

  4.   

    to net_lover:你的代码有误
    <table border>
    <tr><td onclick="a(this)">aaaa</td></tr>
    <tr><td onclick="a(this)">bbbb</td></tr>
    <tr><td onclick="a(this)">aaaa</td></tr>
    </table>
    <script>
    function a(o)
    {
    txt=window.document.body.createTextRange()
    if(txt.findText(o.innerText))
    {
     txt.moveStart("character",0);
      txt.scrollIntoView();
     txt.select();
    }
    }
    </script>