5月26日 CMS 周六

<%@ 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>

聆观静悟、博学储才、经世济人
——王户安《人生的三个阶段》

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值