Demo entry 6769792

作业1

   

Submitted by 苏传奇 on Nov 08, 2018 at 11:16
Language: HTML+PHP. Code size: 2.2 kB.

<%@ page contentType="text/html;charset=GB2312" %>
<%
String path = request.getContextPath();
%>
<html>
<link rel="stylesheet" type="text/css" href="<%=path%>/css/student.css">
<script type="text/javascript" src = "<%=path%>/js/datacheck.js"></script>
  <body>
  <middle>									 
   <form name="frm" method="post">
   <table border=1>
   <tr class="td_header"><td colspan="2"> 课程信息录入,<span class="star"><font color="red">*</font></span>为必填项</td></tr>
   <tr>
   <td>名称</td>
   <td><input type="text" name="name" value="" size="20" maxlength="20"><span class="star"><font color="red">*</font></span>20位字符</td></tr>
   <tr>
   <td>性质</td>
   <td><select name="major" id="majorID">
      <option value="0">公共基础必修课</option>
      <option value="1">专业必修课</option>
      <option value="2">专业选修课</option>
      </select>
      <span class="star"><font color="red">*</font></span></td></tr>
   <tr><td>学分</td><td><input type="text" name="score" value="" size="20" ><span class="star">
   <font color="red">*</font></span>数值</td></tr>
   <tr><td>开设年级</td><td><input type="text" name="grade" value="" size="20" maxlength="4"><span class="star">
   <font color="red">*</font></span>4位整数</td></tr>
   <tr><td>开设专业</td><td><input type="radio" name="lesson" value="0" checked>软件工程<input type="radio" name="lesson" value="1">空间信息<span class="star">
   <font color="red">*</font></span></td></tr>
   <tr><td>备注</td><td><TEXTAREA name="detail"  rows="2" cols="20"> </TEXTAREA>200个字符以内</td></tr>
   <tr><td colspan="2" align="center"><input type="submit"  value="提交" onclick="return check();"></td></tr>
   </table>   
   </form>
   </middle>
  </body>
</html>
<script type="text/javascript">
function check(){

	// TODO 1 课程名称不为空且长度是5~20
	// TODO 2 学分不能为空且为数值
	//3 开设年级不为空且是4位整数

	if(frm.name.value==null||frm.name.value.length>20||frm.name.value.length<5){
		alert("课程名称不为空且长度是5~20");
		frm.name.focus();
		return;
	}
	if(frm.score.value==null||!IsInt(frm.grade.value)){
		alert("学分不能为空且为数值");
		frm.score.focus();
		return;
	}
	if(frm.grade.value.length!=4||!IsInt(frm.grade.value)){
		alert("请给开设年级输入4位整数的年份!");
		frm.grade.focus();
		return;
	}

}
</script>

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).