01总结
今天开学回到学校第一次上课,进行了课堂测试冲刺,测试内容是《河北重大技术需求征集表》,分值15分,我的代码部分如下:
Zhuce页面
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function checkPass(){
var pwd1=document.getElementById("password").value;
var pwd2=document.getElementById("chong").value;
if(pwd1!=pwd2){
document.getElementById("errorpwd").style.display = "block";
}
else{
document.getElementById("errorpwd").style.display = "none";
}
}
function checkPhone(){
var a = document.getElementById("phone");
if(a.value.length!=11){
document.getElementById("errors").style.display = "block";
}
else{
document.getElementById("errors").style.display = "none";
}
}
</script>
<meta charset="UTF-8">
<title>注册</title>
<style type="text/css">
.a{margin-top:20px;}
.b{font-size:20px;width:160px;color:white; }
</style>
</head>
<body>
<%
Object message = request.getAttribute("message");
if(message!=null && !"".equals(message)){
%>
<script type="text/javascript">
alert("<%=request.getAttribute("message")%>");
</script>
<%} %>
<div align="center">
<form action="/case/zhuceServlet" method="post" onsubmit="return check()">
<div class="a">用户姓名:<input type="text" name="username" id="name"></div>
<div class="a">设置密码:<input type="password" name="password" id="password"></div>
<div class="a">重复密码:<input type="password" name="chong" id="chong" onblur="return checkPass();" ></div>
<span id="errorpwd" style="display:none; color:red">两次输入密码不一致</span>
<div class="a">手机号码:<input type="text" name="tel" id="phone" onblur="return checkPhone();"></div>
<span id="errors" style="display:none; color:red">手机号码应该为11位</span>
<div class="a">所属单位:<input type="text" name="workplace" id="place"></div>
<div class="a"><button type="submit" class="b">保 存</button></div>
</form>
</div>
<script type="text/javascript">
function check(){
var name=document.getElementById("name");
var password=document.getElementById("password");
var chong=document.getElementById("chong");
var phone=document.getElementById("phone");
var place=document.getElementById("place");
if(name.value==''){
alert('用户名称为空');
name.focus();
return false;
}
if(password.value==''){
alert('设置密码为空');
password.focus();
return false;
}
if(chong.value==''){
alert('重复密码为空');
chong.focus();
return false;
}
if(phone.value==''){
alert('手机号码为空');
phone.focus();
return false;
}
if(place.value==''){
alert('所属单位为空');
place.focus();
return false;
}
}
</script>
</body>
</html>
Addwork页面
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>添加需求</title>
</head>
<body>
<h3>添加需求</h3>
<form action="/case/addServlet" method="post">
技术需求名称:<input name="brandName"><br>
技术需求合作模式:
<input type="radio" name="hezuo" value="1" id="dan">单人模式
<input type="radio" name="hezuo" value="2" id="duo">双人模式
<br>
研究方式:
<input type="checkbox" name="fangshi" value="1" id="travel">1号类型
<input type="checkbox" name="fangshi" value="2" id="game">2号类型
<input type="checkbox" name="fangshi" value="3" id="TV">3号类型<br>
技术需求概述:<textarea rows="5" cols="20" name="gaishu"></textarea><br>
计划投入金额:<input name="ordered"><br>
需求状态:<input name="ordered"><br>
填报时间:<input name="ordered"><br>
<input type="submit" value="提交">
</form>
</body>
</html>

浙公网安备 33010602011771号