我是JQuery的新手。在学习过程中遇到了点问题,请各位大侠指点
在制作一个客户管理系统的时候,通过数据库,可以找到一些用户,如图所示:图中input框的ID和name均是从数据库中获取到cust_id,然后拼个字符串构成,源代码:
<input type="radio" name="cust_<?=$rs[cust_id]?>" id="cust_<?=$rs[cust_id]?>" value="cust_<?=$rs[cust_id]?>" />jquery代码写在head部分,如果想带上数据库中获取的cust_id,就不明白怎么写了。
请注意下面代码的【???】部分,思路实在是很混乱.恳请大神解答。
<script type="text/javascript">
$(document).ready(function(){
$("#cust_【???】").click(function(){
$.post("cust.php",{cust_id:【???】},function(date){
$("#user").html(date);
 });
});

});
</script>

解决方案 »

  1.   

    不要什么都用jQuery赶那个时髦。
    <input type =radio onclick=loadDiv(uid) />
    function loadDiv(){

    }
    就行.
    至于”更多”你都没讲做什么操作
      

  2.   


    <!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></title>
        <script src="Scripts/jquery-1.8.3.js" type="text/javascript"></script>
        <script>
            $(function () {
                $("#btnTest").click(function () {
                    var id = [];
                    $("#table1 tbody input:checked").each(function () {
                        id.push($(this).val());
                    });
                    alert(id.join(","));
                });
            });
        </script>
    </head>
    <body>
        <table id="table1">
            <body>
                <tr>
                    <th>选中</th>
                    <th>字段1</th>
                    <th>字段2</th>
                    <th>字段3</th>
                </tr>
            </body>
            
            <tbody>
                <tr>
                    <td><input type="checkbox"   value="1"/></td>
                    <td>1</td>
                    <td>2</td>
                </tr>
                <tr>
                    <td><input type="checkbox" value="2"/></td>
                    <td>1</td>
                    <td>2</td>
                </tr>
                <tr>
                    <td><input type="checkbox"    value="3" /></td>
                    <td>1</td>
                    <td>2</td>
                </tr>
            </tbody>    </table>
        <input type="button" id="btnTest" value="test"/></body>
    </html>