?? insertinformation.jsp
字號:
<%@page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage=""%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="css/style.css" type="text/css" rel="stylesheet">
<title>帶有備忘錄的萬年歷</title>
<jsp:useBean id="connection" scope="request" class="com.JDBConnection"/>
<style type="text/css">
<!--
.style1 {
font-size: 24px;
color: #FFFFFF;
font-weight: bold;
}
-->
</style>
<script language="javascript" type="">
function alertMsg(form){
if (form.subject.value=="")
{alert("請添入備忘錄內容!");return false;}
if (form.hours.value=="")
{alert("請添入提示時間!");return false;}
if (isNaN(form.hours.value))
{alert("您添入的提示時間有誤,應為數字類型!");return false;}
if ((form.hours.value>=24) || (form.hours.value<0))
{alert("您添入的提示小時有誤,請確認后再添!");return false;}
if (form.minutes.value=="")
{alert("請添入提示分鐘!");return false;}
if (isNaN(form.minutes.value))
{alert("您添入的提示分鐘有誤,應為數字類型!");return false;}
if ((form.minutes.value>60) || (form.minutes.value<0))
{alert("您添入的提示分鐘有誤,請確認后再添!");return false;}
}
</script>
</head>
<body bgcolor="#9CA6C6">
<%request.setCharacterEncoding("gb2312"); %>
<div align="center" class="style1"> 備
忘
錄
<form name="form" method="post" action="insertInformation.jsp" onSubmit="return alertMsg(form)">
<table width="437" border="0">
<tr>
<td height="30" colspan="5">
<strong>
<font color="#FFFFFF"> 插
入
信
息:
</font>
</strong>
</td>
</tr>
<tr>
<td height="30" colspan="5">
<input name="subject" type="text" size="70">
</td>
</tr>
<tr>
<td width="106" height="30">
<strong>
<font color="#FFFFFF">提醒的具體時間</font>
</strong>
</td>
<td width="98">
<input name="hours" type="text" size="13">
</td>
<td width="71">
<strong>
<font color="#FFFFFF">小時</font>
</strong>
</td>
<td width="71">
<input name="minutes" type="text" size="13">
<input name="showtime" type="hidden" value="<%=request.getParameter("showtime")%>">
</td>
<td width="69">
<strong>
<font color="#FFFFFF">分</font>
</strong>
</td>
</tr>
</table>
<input type="submit" name="Submit2" value="提交">
<input type="button" name="Submit" value="關閉" onClick="javascript:window.close()">
</form>
<%
if (request.getParameter("subject") != null) {
String showTime = request.getParameter("showtime") + "." + request.getParameter("hours") + "." + request.getParameter("minutes");
String sql = "insert into tb_calendar values ('" + request.getParameter("subject") + "','" + showTime + "')";
if (connection.executeUpdate(sql)) {
out.println("添加備忘紀錄正確?。?!");
}
else {
out.println("您填寫的備忘時間已經存在,請重新填寫!??!");
}
connection.closeConnection();
}
%>
</div>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -