本帖最后由 wrost 于 2013-01-23 09:23:16 编辑

解决方案 »

  1.   

    <!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>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"></script>
        <script type="text/javascript">
            function displayInfo() {
                $("#Name").val("test");
            }
            function Info() {
                var y = $("#6 >td:eq(0)").html();
                var x = $("#6 >td:eq(1)").html();
                $("#ID").val(y)
                $("#Name").val(x)
            }
        </script>
    </head>
    <body>
        <h2>
            This is a heading</h2>
        <p>
            This is a paragraph.</p>
        <p>
            This is another paragraph.</p>
        <button onclick="Info()" type="button">
            Click me</button>
        <table width="100%">
            <tr id="6" onmouseover="displayInfo()">
                <td>
                    6
                </td>
                <td>
                    高考文库
                </td>
            </tr>
            <tr id="7" onmouseover="displayInfo()">
                <td>
                    7
                </td>
                <td>
                    中考文库
                </td>
            </tr>
        </table>
        <br />
        <p>
            数字<input class="textbox" id="ID" name="Name" type="text" value="" /></p>
        文库<input class="textbox" id="Name" name="Name" type="text" value="" />
    </body>
    </html>
      

  2.   


    我测试了一下,可以        function Info() {
                var y = $("#6 >td:eq(0)").html();
                var x = $("#6 >td:eq(1)").html();
                $("#ID").val(y)
                $("#Name").val(x)
            }infor里边可以设置参数吗? 比如:        function Info(i) {
                var y = $("#i >td:eq(0)").html();
                var x = $("#i >td:eq(1)").html();
                $("#ID").val(y)
                $("#Name").val(x)
            }
      

  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>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"></script>
        <script type="text/javascript">
            function displayInfo() {
                $("#Name").val("test");
            }
            function Info(i) {
                var y = $("#" + i + " >td:eq(0)").html();
                var x = $("#" + i + " >td:eq(1)").html();
                $("#ID").val(y)
                $("#Name").val(x)
            }
        </script>
    </head>
    <body>
        <h2>
            This is a heading</h2>
        <p>
            This is a paragraph.</p>
        <p>
            This is another paragraph.</p>
        <button onclick="Info(6)" type="button">
            Click me ( For first row ) </button>
        <button onclick="Info(7)" type="button">
            Click me ( For Second row  )</button>
        <table width="100%">
            <tr id="6" onmouseover="displayInfo()">
                <td>
                    6
                </td>
                <td>
                    高考文库
                </td>
            </tr>
            <tr id="7" onmouseover="displayInfo()">
                <td>
                    7
                </td>
                <td>
                    中考文库
                </td>
            </tr>
        </table>
        <br />
        <p>
            数字<input class="textbox" id="ID" name="Name" type="text" value="" /></p>
        文库<input class="textbox" id="Name" name="Name" type="text" value="" />
    </body>
    </html>
      

  4.   


    >  这个符号表示什么意思,?http://www.w3school.com.cn/jquery/jquery_ref_selectors.asp  我在这个教程上没有看到
      

  5.   


    非常感谢,测试可以了。"#6 >td:eq(0)"  中 > 的解释是什么,我在教程上没有找到
      

  6.   


    <table width="100%" style='cursor:pointer;' >