📄 addtk.jsp
字号:
<%@ page language="java" pageEncoding="GBK"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/page.tld" prefix="page" %>
<html>
<head>
<base href="http://localhost:8080/accp_hr/"/>
<title>三级机构添加页面</title>
<script type="text/javascript" src="accp_hr/interface/FirstK.js"></script>
<script type="text/javascript" src="accp_hr/interface/SecondK.js"></script>
<script type="text/javascript" src="accp_hr/engine.js"></script>
<script type="text/javascript" src="accp_hr/util.js"></script>
<script type="text/javascript">
<!--一级机构-->
window.onload=function()
{
FirstK.findAll(null,showfirst);
}
function showfirst(firstlist)
{
DWRUtil.addOptions('firstkn',firstlist,'ffkId','firstKindName');
loadsecond(firstlist[0].ffkId);
}
<!--二级机构查询-->
function loadsecond(firstid){
SecondK.findAll(firstid,showsecond);
}
function showsecond(secondlist){
$('secondkn').options.length=0;
DWRUtil.addOptions('secondkn',secondlist,'fskId','secondKindName');
}
</script>
</head>
<body bgcolor="#DADEDD" style="background-image: url('images/accphr/main.jpg');background-attachment :fixed ;">
<html:form action="thirdKind" onsubmit="return tijiao()">
<input type="hidden" name="optk" value="doAdd"/>
<input type="hidden" id="firstname" name="thirdKind.firstKindName" value="" />
<input type="hidden" id="secondname" name="thirdKind.secondKindName" value="" />
<table align="center" width="100%">
<tr>
<td align="right"><input type="button" value="返回" onclick="javascript:location.href='thirdKind.do?optk=toList'"/></td>
</tr>
<tr>
<td>
<table border="1" cellspacing="0" align="center" width="90%" bordercolor="black" style="font-size: 12px">
<tr>
<th>一级机构名称</th>
<td><html:select property="thirdKind.firstKindId" styleId="firstkn" onchange="loadsecond(this.value)" style="width:250">
</html:select> </td>
</tr>
<tr>
<th>二级机构名称</th>
<td>
<html:select property="thirdKind.secondKindId" styleId="secondkn" style="width:250">
</html:select>
</td>
</tr>
<tr>
<th>部门名称</th>
<td><html:text property="thirdKind.thirdKindName" styleId="kingname"></html:text> </td>
</tr>
<tr>
<th>负责人</th>
<td><html:text property="thirdKind.thirdKindSaleName" styleId="salename"></html:text></td>
</tr>
</table></td>
</tr>
<tr>
<td align="center"><html:submit value="保存" /> <html:reset value="重置" /></td>
</tr>
</table>
</html:form>
</body>
</html>
<script type="text/javascript">
<!--信息提交验证-->
function tijiao(){
setKindName();
var kindn=document.getElementById('kingname').value;
if(kindn=='')
{
alert('请输入部门名称!');
return false;
}
var salen=document.getElementById('salename').value;
if(kindn=='')
{
alert('请输入负责人!');
return false;
}
}
<!--给隐藏域的一级、二级机构赋值-->
function setKindName(){
//一级标题
var temp=document.getElementById("firstkn").options;
for(var i=0;i<temp.length;i++){
if(temp[i].selected)
{
document.getElementById("firstname").value=temp[i].innerText;
}
}
//二级标题
var temp=document.getElementById("secondkn").options;
for(var i=0;i<temp.length;i++){
if(temp[i].selected)
{
document.getElementById("secondname").value=temp[i].innerText;
}
}
}
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -