<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'upd.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>
<script type="text/javascript">
var id = ${param.id};
//下拉列表
$.ajax({
url:"show!down",
type:"post",
data:{id:id},
dataType:"json",
success:function (msg){
for(var i in msg){
$("select").append("<option value="+msg[i].did+">"+msg[i].content+"</option>");
}
}
});
//回显
$.ajax({
url:"show!toshow",
type:"post",
data:{id:id},
dataType:"json",
success:function (msg){
$("#id").val(msg.id);
$("#name").val(msg.name);
$("[value='"+msg.sex+"']").attr("checked",true);
var hobbys = msg.hobby.split(",");
for(var i in hobbys){
$("[value="+hobbys[i].trim()+"]").attr("checked",true);
}
$("select").val(msg.did);
$("#address").val(msg.address);
}
});
</script>
</head>
<body>
id:<input type="text" id="id" ><br>
name:<input type="text" id="name"><br>
sex:<input type="radio" value="男" id="sex">男
<input type="radio" value="女" id="sex">女<br>
hobby:<input type="checkbox" value="绘画" id="hobby">绘画
<input type="checkbox" value="唱歌" id="hobby">唱歌
<input type="checkbox" value="骑马" id="hobby">骑马<br>
did:<select>
</select>
<br>
address:<input type="text" id="address"><br>
<input type="button" value="提交">
</body>
</html>
聆观静悟、博学储才、经世济人
——王户安《人生的三个阶段》
239

被折叠的 条评论
为什么被折叠?



