initialise_gt.jsp

来自「JSP页面和oracle9i数据库的源代码」· JSP 代码 · 共 134 行

JSP
134
字号
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>工天初始化</title>
<style>
<!--
a {text-decoration: none}
.f1          { font-size: 9pt; font-family: Verdana; line-height: 15pt }
.f2          { font-size: 8pt; font-family: Verdana; line-height: 12pt }
body {
	background-image: url(../img/adminbg.gif);
}
input.noborInput{background:#ffffff; border-bottom-width:0px;border-top-width:0px;border-left-width:0px;border-right-width:0px; solid #ff6633; COLOR: #3300FF; FONT-SIZE: 10pt}
input.smallInput{BACKGROUND-COLOR: rgb(255,255,255); BORDER-BOTTOM: rgb(80,139,220) 1px solid; BORDER-LEFT: rgb(80,139,220) 1px solid; BORDER-RIGHT: rgb(80,139,220) 1px solid; BORDER-TOP: rgb(80,139,220) 1px solid}
input.buttonface{BACKGROUND: #CCCCFF; border:1 solid #CC33FF; COLOR: #CC00FF; FONT-SIZE: 9pt; FONT-STYLE: normal; FONT-VARIANT: normal; FONT-WEIGHT: normal; HEIGHT: 18px; LINE-HEIGHT: normal}
-->
</style>
<script Language="JavaScript">
function on_gt(form,daynum){
		var strs=form.gt.value;
		var daynum;
		if( !isAllNumber(strs)){
			form.gt.value="";
			alert("请输入正确的数据--数字!");
			form.gt.focus();
		}  
		if(strs>daynum) {
		form.gt.value="";
		alert("请输入正确的数据--至多"+daynum+"天!");
		form.gt.focus();}   
	}
	function isAllNumber(jcny_year)
	{
		var test = true;
		for(var j=0;j<jcny_year.length;j++)
		{
			if(jcny_year.substring(j,j+1) != "0"&&
				jcny_year.substring(j,j+1) != "1"&&
				jcny_year.substring(j,j+1) != "2"&&
				jcny_year.substring(j,j+1) != "3"&&
				jcny_year.substring(j,j+1) != "4"&&
				jcny_year.substring(j,j+1) != "5"&&
				jcny_year.substring(j,j+1) != "6"&&
				jcny_year.substring(j,j+1) != "7"&&  
				jcny_year.substring(j,j+1) != "8"&&
				jcny_year.substring(j,j+1) != "9")
				test=false;
		}  
		return test;
	}
function  validate()
    {
		if  (document.form1.gt.value=="")
        {
            alert("工天不能为空!");
            document.form1.gt.focus();
            return false ;
        }
	}
</script>
</head>

<body>
<jsp:useBean id="conn" scope="page" class="beans3.conn"/>
<% 
String page_type=(String)session.getAttribute("page_type");
String page_name=(String)session.getAttribute("page_name");
if(page_type==null){page_type="";}
if(session.isNew()){response.sendRedirect("../index.jsp");}
else
{	if(!(page_type.equals("super")) && !page_type.equals("sgz"))
	{response.sendRedirect("../index.jsp");}	
} 
%>
<%
String condition=null;
ResultSet rs=null;
String gt=request.getParameter("gt");
if(gt==null){}
else{
float GT=Float.parseFloat(gt);
condition="update BZGZ set GT="+GT+" where BH not like 'L%'";
conn.executeUpdate(condition);
}
%>
<%
condition="select to_char(last_day(sysdate),'dd') days from dual";
rs=conn.executeQuery(condition);
String daynum=null;
while(rs.next())
{daynum=rs.getString("days");
}
%>
<%
condition="select DISTINCT GT from BGZDH.BZGZ where BH not like 'L%'";
rs=conn.executeQuery(condition);
%>
<div align="center">
<form name="form1" method="post" action="initialise_gt.jsp" onsubmit="return  validate()">
  <p>&nbsp;  </p>
  <p>&nbsp;</p>
  <table width="260" border="1" cellpadding="1" cellspacing="0" bordercolor="#6699FF" class="f1">
    <tr>
      <td height="30" colspan="2" scope="col"><div align="center"><strong>设置本月工天</strong></div></td>
      </tr>
    <tr>
      <td width="130" height="32" scope="col"><div align="right">请输入本月工天:</div></td>
      <th scope="col"><div align="left">

        <input name="gt" type="text" class="noborInput" id="gt" style="BACKGROUND-COLOR: rgb(255,255,255); BORDER-BOTTOM: rgb(80,139,220) 1px solid; BORDER-LEFT: rgb(80,139,220) 1px solid; BORDER-RIGHT: rgb(80,139,220) 1px solid; BORDER-TOP: rgb(80,139,220) 1px solid" onChange="on_gt(this.form,<%=daynum%>)" value="<%=daynum%>" size="8" maxlength="3">
      </div></th>
    </tr>
    <tr>
      <td height="34" colspan="2"><div align="center">
                     <input name="Sub" type="submit" class="buttonface" value="提交">
          &nbsp;        
              <input name="re" type="reset" class="buttonface" value="重置">&nbsp;
              <input name="exit" type="button" class="buttonface" onClick="location.href='../index/gz_index.jsp';" value="退出">
            <br>
        </div></td>
    </tr>
  </table>
 <p class=f1>当前工天为<%while(rs.next())
	  {out.print(rs.getString("GT"));
	  out.print(" ");
	  }%>天</p>
</form>
</div>

</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?