<table> <form action="updatePerson.do?personId=${sessionScope.updateById.personId}" method="post"> <tr> <td>姓名:</td> <td><input type="text" name="personName" value="${sessionScope.updateById.personName}"></td> </tr> <tr> <td>称呼:</td> <td> <input type="text" name="personNickName" value="${sessionScope.updateById.personNickName}"></td> </tr> <tr> <td>性别:</td> <td><input type="radio" name="personSex" value="${sessionScope.updateById.personSex}">男<input type="radio" name="personSex" value="${sessionScope.updateById.personSex}">女</td> </tr> <tr> <td> 类别:</td> <td><input type="text" name="kindId" value="${sessionScope.updateById.kindId}"></td> </tr> <tr> <td>生日:</td> <td><input type="text" name="personBirthday" value="${sessionScope.updateById.personBirthday}"></td> </tr> <tr> <td>电话:</td> <td><input type="text" name="personTelephone" value="${sessionScope.updateById.personTelephone}"></td> </tr> <tr> <td>QQ:</td> <td> <input type="text" name="personQQ" value="${sessionScope.updateById.personQQ}"></td> </tr> <tr> <td> 邮箱:</td> <td><input type="text" name="personEmail" value="${sessionScope.updateById.personEmail}"></td> </tr> <tr> <td> 地址:</td> <td> <input type="text" name="personAddress" value="${sessionScope.updateById.personAddress}"></td> </tr> <tr> <td> MSN:</td> <td><input type="text" name="personMSN" value="${sessionScope.updateById.personMSN}"></td> </tr> <tr> <td> 简介:</td> <td><textarea cols="10" rows="5" name="personInfo">${sessionScope.updateById.personInfo}</textarea></td> </tr> <tr> <td><input type="submit" name="重填" value="重填"></td> <td><input type="submit" name="提交" value="提交"></td> </tr> </form> </table>为上述代码设计简单分格的ss和js代码
时间: 2023-07-02 08:15:03 浏览: 108
Java-银行管理系统源代码.pdf
以下是简单的HTML和JavaScript代码:
HTML代码:
```html
<table>
<form id="updateForm" action="updatePerson.do?personId=${sessionScope.updateById.personId}" method="post">
<tr>
<td>姓名:</td>
<td><input type="text" name="personName" value="${sessionScope.updateById.personName}"></td>
</tr>
<tr>
<td>称呼:</td>
<td><input type="text" name="personNickName" value="${sessionScope.updateById.personNickName}"></td>
</tr>
<tr>
<td>性别:</td>
<td>
<input type="radio" name="personSex" value="男" checked>男
<input type="radio" name="personSex" value="女">女
</td>
</tr>
<tr>
<td> 类别:</td>
<td><input type="text" name="kindId" value="${sessionScope.updateById.kindId}"></td>
</tr>
<tr>
<td>生日:</td>
<td><input type="text" name="personBirthday" value="${sessionScope.updateById.personBirthday}"></td>
</tr>
<tr>
<td>电话:</td>
<td><input type="text" name="personTelephone" value="${sessionScope.updateById.personTelephone}"></td>
</tr>
<tr>
<td>QQ:</td>
<td><input type="text" name="personQQ" value="${sessionScope.updateById.personQQ}"></td>
</tr>
<tr>
<td> 邮箱:</td>
<td><input type="text" name="personEmail" value="${sessionScope.updateById.personEmail}"></td>
</tr>
<tr>
<td> 地址:</td>
<td><input type="text" name="personAddress" value="${sessionScope.updateById.personAddress}"></td>
</tr>
<tr>
<td> MSN:</td>
<td><input type="text" name="personMSN" value="${sessionScope.updateById.personMSN}"></td>
</tr>
<tr>
<td> 简介:</td>
<td><textarea cols="10" rows="5" name="personInfo">${sessionScope.updateById.personInfo}</textarea></td>
</tr>
<tr>
<td><input type="button" name="重填" value="重填" onclick="resetForm()"></td>
<td><input type="button" name="提交" value="提交" onclick="submitForm()"></td>
</tr>
</form>
</table>
```
JavaScript代码:
```javascript
function resetForm() {
document.getElementById("updateForm").reset();
}
function submitForm() {
var form = document.getElementById("updateForm");
if (form.checkValidity()) {
form.submit();
} else {
alert("请完善所有信息!");
}
}
```
其中,resetForm()函数用于重置表单,submitForm()函数用于提交表单。在submitForm()函数中,我们使用了form.checkValidity()方法来检查表单是否完整,如果表单完整,则使用form.submit()方法提交表单,否则弹出提示框提醒用户完善表单信息。
阅读全文