记录用户信息的jsp页面(包含对于爱好和出生日期的js)
来源:互联网 发布:淘宝店铺处罚考试答案 编辑:程序博客网 时间:2024/05/24 22:45
addcustomer.jsp页面:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>添加客户</title>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/customer.js"></script>
</head>
<body style="text-align: center;" onload="pageInit()">
<form action="${pageContext.request.contextPath }/servlet/AddCustomerServlet" method="post"onsubmit="return dosubmit()" id="customer">
<table width="55%" border="1">
<tr>
<td>客户姓名</td>
<td>
<input type="text" name="name">
</td>
</tr>
<tr>
<td>性别</td>
<td>
<input type="radio" name="gender" value="男">男
<input type="radio" name="gender" value="女">女
</td>
</tr>
<tr>
<td>生日</td>
<td>
<select id="year">
<option value="1900">1900</option>
</select>年
<select id="month">
<option value="01">01</option>
</select>月
<select id="day">
<option value="01">01</option>
</select>日
</td>
</tr>
<tr>
<td>手机</td>
<td>
<input type="text" name="cellphone">
</td>
</tr>
<tr>
<td>邮箱</td>
<td>
<input type="text" name="email">
</td>
</tr>
<tr>
<td>爱好</td>
<td>
<c:forEach var="pre" items="${preferences}">
<input type="checkbox" name="pre" value="${pre }">${pre }
</c:forEach>
</td>
</tr>
<tr>
<td>客户类型</td>
<td>
<c:forEach var="type" items="${types}">
<input type="radio" name="type" value="${type }">${type }
</c:forEach>
</td>
</tr>
<tr>
<td>客户备注</td>
<td>
<textarea rows="5" cols="50" name="description"></textarea>
</td>
</tr>
<tr>
<td>
<input type="reset" value="清空">
</td>
<td>
<input type="submit" value="添加客户">
</td>
</tr>
</table>
</form>
</body>
</html>
相关的customer.js
function pageInit()
{
makeYear();
makeMonth();
makeDay();
}
function makeYear(){
var year = document.getElementById("year");
for(var i=1901;i<=new Date().getYear();i++){
var option = document.createElement("option");
option.value = i;
option.innerText = i;
year.appendChild(option);
}
}
function makeMonth()
{
var month = document.getElementById("month");
for(var i=2;i<=12;i++)
{
var option = document.createElement("option");
if(i<10)
{
option.value = '0' + i;
option.innerText = '0' + i;
}else{
option.value = i;
option.innerText = i;
}
month.appendChild(option);
}
}
function makeDay()
{
var day = document.getElementById("day");
for(var i=2;i<=31;i++)
{
var option = document.createElement("option");
if(i<10)
{
option.value = '0' + i;
option.innerText = '0' + i;
}else{
option.value = i;
option.innerText = i;
}
day.appendChild(option);
}
}
function dosubmit()
{
makeBirthday();
makePreference();
return true;
}
function makeBirthday(){
var year = document.getElementById("year").value;
var month = document.getElementById("month").value;
var day = document.getElementById("day").value;
var birthday = year + "-" + month + "-" + day;
var input = document.createElement("input");
input.type="hidden";
input.name = "birthday";
input.value = birthday
document.getElementById("customer").appendChild(input);
}
function makePreference()
{
var preference = "";
var pres = document.getElementsByName("pre");
for(var i=0;i<pres.length;i++)
{
if(pres[i].checked==true)
{
preference = preference + pres[i].value + ",";
}
}
preference = preference.substr(0,preference.length-1);
var input = document.createElement("input");
input.type = "hidden";
input.name = "preference";
input.value=preference;
document.getElementById("customer").appendChild(input);
}
0 0
- 记录用户信息的jsp页面(包含对于爱好和出生日期的js)
- JSP页面的静态包含和动态包含
- jsp中的页面转向和页面包含(resquest.getRequestDispather.for和response.sendRedirect等的区别)
- JSP页面的动态包含和静态包含示例及介绍
- jsp的动态包含和静态包含
- JSP的静态包含和动态包含
- jsp包含页面的三种方式
- jsp中有两种包含页面的方法
- jsp中几种包含页面的方式区别
- 用字典创建一个平台的用户信息(包含用户名和密码)管理系统
- 身份证号码与出生日期的JS验证
- Jsp页面中判断字符串是否包含另一个字符串的两种方法,js判断包含的indexOf()方法
- jsp页面的js定时器的实现和关闭(不跳转页面)
- jsp页面关于Java,js和html的加载顺序
- 对于JSP代码和JavaScript的理解
- useBean(通过jsp申明对象)、 包含(include )、 <jsp:forward page="转发的页面>
- JavaScript身份证和出生日期的验证
- jsp页面引入(包含)其他页面的三种实现方式
- SystemServer 启动流程
- 学习LDA后的一点感想
- python中@classmethod与@staticmethod的区别和用法
- EXT中获取地址参数
- app自动升级(初级版)
- 记录用户信息的jsp页面(包含对于爱好和出生日期的js)
- 装机员U盘启动PE制作工具V4.0(UEFI+UD)
- 《Nodejs开发加密货币》之二十四:DPOS机制(分布式共识算法)
- Android —— 插件化
- 大话设计模式-----策略模式
- C#连接EXCEL和ACCESS字符串2003及2007版
- 页面中分帧
- Android Camera的使用 (三)
- spring3 的restful API RequestMapping介绍