首页 > 代码如下,请问如何将table里的多组score提交到后台

代码如下,请问如何将table里的多组score提交到后台

<table style="text-align: center" border="1" id="mytable">
            <thead>
                <tr>
                    <th>编号</th>
                    <th>课程编号</th>
                    <th>课程名称</th>
                    <th>学生学号</th>
                    <th>学生姓名</th>
                    <th>学生专业</th>
                    <th>学生性别</th>
                    <th>分数录入</th>
                </tr>
            </thead>
            <tbody>
                <c:forEach items="#{listtpick}" var="tag" varStatus="id">
                    <tr>
                        <%-- <td>${id.count }</td> --%>
                        <td>${tag.pickid}</td>
                        <td>${tag.courseid}</td>
                        <td>${tag.coursename}</td>
                        <td>${tag.studentid}</td>
                        <td>${tag.studentname}</td>
                        <td>${tag.studentacademy}</td>
                        <td>${tag.studentsex}</td>
                        <td><s:textfield name="score" id="score" required="true"
                                theme="simple" cssStyle="width:80px"></s:textfield>
                        </td>
                    </tr>
                </c:forEach>
            </tbody>

        </table>

首先多组score就不要用同一个id了 没法取到的 建议用class 例如你所有的score的输入框 class都是score 然后用jquery var sc = $(".score")就获取到了所有的score输入框 然后循环读取内容 $(sc[i]).val(); 你可以存在一个数组里 也可以用字符串分割 具体看你后台取到数据怎么处理 前后统一就行 数据包装完以后用 $.ajax提交或者放到隐藏表单元素里调用submit都行

【热门文章】
【热门文章】