<input type="button" onclick="document.getElementById('tab2').getElementsByTagName('input')[0].focus()" value="ssss">

解决方案 »

  1.   

    function _click(i){
    var o=document.getElementsByTagName("input");
    o(i).focus();
    }_click(0);
      

  2.   

    <html> 
    <head> 
        <title> </title> 
    <script>
    function i2Focus(){
    document.getElementById("i2").focus();
    }
    </script>
    </head> 
    <body> 
      <input type="text" id="i1">
      <input type="text" id="i2">
      <input type="button" id="b1" onClick="i2Focus()" value="点击">
    </body> 
    </html> 
      

  3.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
        <title>Untitled Page</title>
    </head>
    <body><table id="tab1"> 
    <tr> <td> <input type="text" > </td> </tr> 
    <tr> <td> <input type="text" > </td> </tr> 
    <tr> <td> <input type="text" > </td> </tr> 
    <tr> <td> <input type="text" > </td> </tr> 
    <tr> <td> <input type="text" > </td> </tr> 
    </table> 
    <table id="tab2"> 
    <tr> <td> <input type="text" > </td> </tr> 
    <tr> <td> <input type="text" > </td> </tr> 
    <tr> <td> <input type="text" > </td> </tr> 
    <tr> <td> <input type="text" > </td> </tr> 
    <tr> <td> <input type="text" > </td> </tr> 
    </table> 
    <input type="button" onclick="getFocus()"> <script type="text/javascript">
    function getFocus(){
        document.getElementById('tab2').getElementsByTagName('input')[0].focus();
    }
    </script>
    </body>
    </html>