⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 add_unit_next.jsp

📁 asp中经典的克隆函数
💻 JSP
字号:
<%@ page errorPage="err.jsp" %>
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page language="java" import="java.sql.*"%>
<%
if (session.getAttribute("admin")==null || session.getAttribute("admin")=="" 
	|| session.getAttribute("scope")==null || !session.getAttribute("scope").equals("input_y"))
{
	//response.sendRedirect("index.jsp");
	out.println("<script language=javascript>window.top.location.href='index.jsp'</script>");
} 
%>

<%
	
	String year = request.getParameter("year");
%>
<jsp:useBean id="sqlbean" scope="page" class="qqhr.sql_data"/>
<jsp:useBean id="transcode" scope="page" class="qqhr.TransFormat"/>
<jsp:useBean id="pager" scope="page" class="qqhr.page" />
<HTML>
	<HEAD>
		<title></title>
		<link href="sun/css/css_ns6up.css" rel="stylesheet" type="text/css">
		<link href="style/style.css" rel="stylesheet" />

		<style type=text/css>
		a:link {
			color:  #336699;
			text-decoration: none;
		}
		a:visited {
			color:  #336699;
			text-decoration: none;
		}
		a:hover {
			color: #FF9900;
			text-decoration: underline;
		}
		a:active {
			color: #FF9900;
			text-decoration: none;
		}
		body {
			background-image: url(images/bg_main_white.jpg);
			background-repeat: no-repeat;background-attachment:fixed;background-position:100% 0%
		}
		</style>
		<style type="text/css">
div.DataGrid
{
  overflow: auto;
  height: 380;
  width: 693;
}
        </style>
<SCRIPT LANGUAGE="JavaScript">
function fixupFirstRow(tab)
{
  var div = tab.parentNode;
  if(div.className.toLowerCase() == "datagrid")
  {
    tab.rows[0].style.zIndex = "1";
    tab.rows[0].style.position = "relative";
    div.onscroll = function()
    {
      var tr = tab.rows[0];
      tr.style.top = this.scrollTop - (this.scrollTop==0 ? 1 : 2);
    }
  }
}
window.onload = function()
{
  var tab = document.getElementById("content");
  if(tab) fixupFirstRow(tab);
}
</SCRIPT>
	</HEAD>

	<body MS_POSITIONING="FlowLayout">
		<div id="place1">&nbsp;&nbsp;&nbsp;&nbsp;您的位置:录入修改预算 &gt; <%=year%>年市直行政事业单位预算调整明细表</div>

        <form method="post" action="y03_add_unit_save.jsp?action=save&year=<%=year%>" name="form1">
		<table width="804" border="0" cellpadding="0" cellspacing="0">
              <!--DWLayoutTable-->
              <tr>
                
                <td width="693" height="439" valign="top"><table class="Tbl" width="100%" border="0" cellpadding="0" cellspacing="0" title="" summary="instances.summary">
                  <!--DWLayoutTable-->
<caption class="TblTtlTxt">核对确认录入--<%=year%>年市直行政事业单位预算调整明细表</caption>
<tr>
  <td width="693" height="32" valign="middle" class="TblActTd">&nbsp;&nbsp;&nbsp;<img src="sun/images/masthead/status_icon.gif" width="16" height="16"> 请核对确认所添加的单位数据!</td>
  </tr>
                                                </table>                  <div class=DataGrid>
                    <table class="Tbl" width="100%" border="0" cellpadding="0" cellspacing="0" id="content">
                      <!--DWLayoutTable-->
                      <tr>
                        <th width="53" height="24" align="left" valign="top" class="TblColHdrSrtCl1" scope="col"><span class="TblHdrTxt">&nbsp;</span></th>
    <th width="100" align="left" valign="top"  class="TblColHdr" scope="col"><span class="TblHdrTxt">单位编码</span></th>
    <th width="140" align="left" valign="top"  class="TblColHdr" scope="col"><span class="TblHdrTxt">一级科目单位</span></th>
    <th width="209" align="left" valign="top"  class="TblColHdr" scope="col"><span class="TblHdrTxt">二级科目单位</span></th>
    <th width="198" align="left" valign="top"  class="TblColHdr" scope="col"><span class="TblHdrTxt">三级科目单位</span></th>
    </tr>
  <%
	ResultSet rs = null;
	String  bm = null,first=null,second=null,third=null,kind=null,selectsql=null;
  	String str_first_id = null;
	int first_id = 0,second_id = 0;
	String action=request.getParameter("action");
	if(action!=null && action!="")
   {
	if(action.equals("save"))
	{	
	    bm=transcode.GB2unicode(request.getParameter("bm0"));//取得编码
	    //second=transcode.GB2unicode(request.getParameter("second0"));//取得二级新单位
		if(request.getParameter("unit0")!=null && request.getParameter("unit0")!="")
		{
			//parent0=Integer.valueOf(request.getParameterNames()).intValue();
			first=transcode.GB2unicode(request.getParameter("unit0"));//取得一级新单位
			selectsql="select id,kind from y031 where dw='"+first+"'  and type=0 and nian_fen='"+year+"'";
			rs=sqlbean.executeQuery(selectsql);
			if(rs.next())
			{	
				first_id=rs.getInt("id"); //一级单位对应的id !
				str_first_id = (String)String.valueOf(first_id);
				request.setAttribute("str_first_id",str_first_id); //保存起来!
				kind=rs.getString("kind");
				request.setAttribute("kind",kind); //保存起来!
			}
			rs.close();
			selectsql=null;
		}//end if
		
		
		
		if(request.getParameter("third0")!=null && request.getParameter("third0")!="")
		{
			third=transcode.GB2unicode(request.getParameter("third0"));
			if(request.getParameter("newunit")!=null && request.getParameter("newunit")!="")
			{
				second=transcode.GB2unicode(request.getParameter("newunit"));
				out.print("<script language='javascript'>alert('second:"+second+"')</script>");
				selectsql="select id,kind from y031 where dw='"+second+"'  and type=0 and nian_fen='"+year+"'";
			    rs=sqlbean.executeQuery(selectsql);
				if(rs.next())
				{	
					second_id=rs.getInt("id");
					kind=rs.getString("kind");
				}
		out.print("<script language='javascript'>alert('unit:"+second+" second_id:"+second_id+" bm:"+bm+" third:"+third+" kind:"+                          kind+"year:"+year+"')</script>");
				rs.close();
				selectsql=null;
			}
		} //此添加三级单位但是二级单位有两种可能(1)从下拉列表中自选的(2)在文本框中输入的。但是后者在这里没有得到实现!
		
		else //此时仅添加的是二级单位,不添加三级单位!
		{
			if(request.getParameter("second0")!=null && request.getParameter("second0")!="")
			{
				second = transcode.GB2unicode(request.getParameter("second0"));//取得二级新单位
			}
			third = "";
			//此时parent 和 kind 从一级单位那里获得!
		}
		
	}//end if(action==save)
}//end if (action!=null && action!="")
 
		

		
	
%>
                      <tr valign="top">
                        <td width="53" height="24" align="center" valign="middle" class="TblTdSrtCl1"><img src="images/arrow3.gif" width="13" height="12"></td>
    
<td align="center" valign="middle"><input name="bm" type="text" class="input_color" id="bm" value="<%=bm%>" size="10" readonly="1"></td>

<td align="center" valign="middle"><input name="first" type="text" class="input_color" id="first" value="<%=first%>" size="15" readonly="1"></td>
    <td align="center" valign="middle"><input name="second" type="text" class="input_color" id="second" value="<%=second%>" size="20" readonly="1"></td>
    <td align="center" valign="middle"><input name="third" type="text" class="input_color" id="third0" value="<%=third%>" size="20" readonly="1"></td>
    </tr>
                      <tr>
                        <td height="0"></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                      </tr>
                      </table>
                  </div></td>
                <td width="111">&nbsp;</td>
              </tr>
              <tr>
                <td height="18">&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td height="30" align="center" valign="middle">
				<input name="confirm" type="submit" class="Btn1" id="confirm" onFocus="javascript: if (this.disabled==0) this.className='Btn1Hov'" onBlur="javascript: if (this.disabled==0) this.className='Btn1'" onMouseOver="javascript: if (this.disabled==0) this.className='Btn1Hov'" onMouseOut="javascript: if (this.disabled==0) this.className='Btn1'" value="保存" />

                <input name="cancel" type="button" class="Btn1" id="cancel" onClick="javascript:history.back(-1)" onFocus="javascript: if (this.disabled==0) this.className='Btn1Hov'" onBlur="javascript: if (this.disabled==0) this.className='Btn1'" onMouseOver="javascript: if (this.disabled==0) this.className='Btn1Hov'" onMouseOut="javascript: if (this.disabled==0) this.className='Btn1'" value="取 消" /></td>
                <td>&nbsp;</td>
              </tr>
            </table>
  	</form>
</body>
</HTML>

⌨️ 快捷键说明

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