要用 JAVASCRIPT 了,需要数组!
解决方案 »
- hibernate同时保存一对多的两张表发生异常:Cannot add or update a child row
- 找个治疗URL传中文参数乱码的主任级别医生,回复留下QQ。
- 求救struts-tags 及 textarea 问题!!!
- 大家帮忙看看这个判断。
- 如何在没有域名的情况下在局域网中发布jsp网站试用(服务器为TOMCAT)
- jsp里判断字符串长度?
- 有关字段----显示完整----的过程!(非常急)
- 这样该如何实现,有谁知道?
- 用tomcat4.04连接池,为什么报错:java.lang.ClassCastException: tyrex.jdbc.xa.EnabledDataSource ?
- 为何不使用window.location.href 而都使用ajax呢
- 我是个新手,请大家多帮忙!有个问题请教:如何传递数组参数?急!!多谢多谢
- 大家来讨论一下,用哪种工具开发JSP比较好?各有什么优势?开发过程中应该注意什么?
<head>
<title>List</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script LANGUAGE="javascript">
<!--
var onecount;
onecount=0;
subcat = new Array();
subcat[0] = new Array("徐汇区","01","001");
subcat[1] = new Array("嘉定区","01","002");
subcat[2] = new Array("黄浦区","01","003");
subcat[3] = new Array("南昌市","02","004");
subcat[4] = new Array("九江市","02","005");
subcat[5] = new Array("上饶市","02","006");onecount=6;function changelocation(locationid)
{
document.myform.smalllocation.length = 0; var locationid=locationid;
var i;
document.myform.smalllocation.options[0] = new Option('====所有地区====','');
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.myform.smalllocation.options[document.myform.smalllocation.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
} //-->
</script>
</head>
<body>
<form name="myform" method="post">
<select name="biglocation" onChange="changelocation(document.myform.biglocation.options[document.myform.biglocation.selectedIndex].value)">
<option value="01" selected>上海</option>
<option value="02">江西</option>
</select>
<select name="smalllocation">
<option selected value="">==所有地区==</option>
</select>
</form>
<script LANGUAGE="javascript">
<!--
changelocation(document.myform.biglocation.options[document.myform.biglocation.selectedIndex].value);
//-->
</script>
</body>
</html>
<head>
<title>test</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
td { font-family: "宋体"; font-size: 9pt; line-height: 1.7em}
a:link { color: #000000; text-decoration: none}
a:visited { color: #000000; text-decoration: none}
a:hover { color: #FFFFFF; text-decoration: underline}
-->
</style>
<script language="Javascript">
function checkt1()
{
if (document.form1.askid.value=="")
{
alert("你还没有输入申请单号!")
document.form1.askid.focus();
return false;
}
return true;
}
</script></head><body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" background="images/bottomback.gif" onLoad="changecbranch(document.form1.siteid.options[document.form1.siteid.selectedIndex].value)">
<table width="778" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="4"><img src="images/top.gif" width="778" height="72"></td>
</tr>
<tr>
<td width="12" background="images/leftback.gif"> </td>
<td width="177" align="center" bgcolor="#eeeeee" valign="top"> <br>
<table width="100%" border="0">
<tr>
<td>
<ul>
<li>对新操作员付权限</li>
<li>修改权限</li>
</ul>
</td>
</tr>
<tr>
<td><font color="#FF0000"><b>操作方法:</b></font></td>
</tr>
<tr>
<td>
<ul>
<li>对单个操作员付权限</li>
<li>对一个操作点下的所有员工付权限</li>
</ul>
</td>
</tr>
</table>
<p><br>
<br>
</p>
</td>
<td width="577" align="center" bgcolor="#FFFFFF">
<table width="400" border="0">
<tr>
<td>
<div align="center"><b><font color="#FF0000" size="3">权限设置</font></b></div>
</td>
</tr>
</table>
<br>
<table width="400" border="1" cellpadding="5">
<tr>
<td>
<table width="300" border="0" align="center">
<tr>
<td> <form name="form1" method="post" action="limitb.asp">
<br>
操作点:
<%@ include file="CicsConn.jsp" %>
<%
oEc.BeginWrite();
oEc.CallProgramAndCommit ("XLTSITEB");
String flag=oEc.GetValue("SUCCESS");
// out.println("flag="+flag);
if (flag=="-1")
{
String str="服务器程序没有启动或出错";
response.sendRedirect( "errorstr.asp?str="+str);
return;
}
oEc.RsOpen();
int rc=oEc.RsGetRowNum();
%>
<select name="siteid" onChange="changecbranch(document.form1.siteid.options[document.form1.siteid.selectedIndex].value)" >
<% for (int i=1;i<=rc;i++)
{
oEc.RsFetchRow();
%>
<option value="<%=oEc.RsGetCol(1)%>"><%=oEc.RsGetCol(2)%></option>
<% } %>
</select>
<br>
<br>
操作员:
<select name="staffid">
</select><%
oEc.BeginWrite();
oEc.CallProgramAndCommit ("XLTSTAFB");oEc.RsOpen();
int rc2=oEc.RsGetRowNum();String sjavascript="var onecount;"+ "onecount=0;"+ "subcat=new Array();";
int count=0;
for (int i=1;i<=rc2;i++)
{
oEc.RsFetchRow();
sjavascript=sjavascript + "subcat["+count+"]=new Array("+oEc.RsGetCol(2)+","+oEc.RsGetCol(3)+","+oEc.RsGetCol(1)+");";
count=count+1;
out.println ("sjavascript="+sjavascript);
//return;
}
sjavascript=sjavascript + "onecount="+count+";";
sjavascript=sjavascript + " function changecbranch(locationid)" + "{" +
"document.form1.staffid.length = 0;"+ "var locationid=locationid;"+ "var i;";
sjavascript=sjavascript + "for(i=0;i<onecount;i++)"+"{ "+
" if (subcat[i][1]==locationid)"+ "{ "+
"document.form1.staffid.options[document.form1.staffid.length] = new Option(subcat[i][0], subcat[i][2]);"+
"}" + " }"+ " }" ;
out.println ("<SCRIPT LANGUAGE=JavaScript>");
out.println (sjavascript+ "</SCRIPT>");
%> <br>
<br>
<input type="checkbox" name="alllimit" value="1">
对操作点下的所有操作员付权限<br>
<br>
<input type="submit" name="Submit" value="提交">
<input type="submit" name="Submit2" value="取消">
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width="12" background="images/rightback.gif"> </td>
</tr>
<tr align="center" >
<td colspan="4" background="images/bottomback.gif"><font color="#FFFFFF">CopyRight(C)
2001 版权所有:</font></td>
</tr>
</table>
</body>
</html>
//通用方法
//File Name : Prov_manage.jsp
//Creator : zql
//Created Date : 2001-11-15
//Last Modified Date: 2001-11-15 Modifier zql
//说明: 商品种类模块的父类查询功能
//------------------------------------------------------------------------
%><%@ page contentType="text/html; charset=GBK" %>
<html>
<head>
<title>查询商品种类代码,树状显示</title>
<link REL="stylesheet" HREF="../../css/style.css" TYPE="text/css">
<script language="javascript">
<!--
function kindselect()
{
return parent.main_down.frm_select.submit();
}
--></script>
</head>
<%@page import="com.gdpost.wl.hgoodsinformmngt.entitymodel.*,com.gdpost.wl.hgoodsinformmngt.web.*,com.gdpost.wl.hgoodsinformmngt.dbclass.*,com.gdpost.wl.hcrm.util.exception.*,com.gdpost.wl.hcrm.util.dbclass.DBResultSet,java.util.Vector,java.lang.Long,java.util.Vector,java.lang.Float,java.math.*,java.sql.*"%>
<body leftmargin="5" topmargin="5">
<%
MatKindController MatKin;
MatKind Mat = new MatKind();
MatKin = new MatKindController();
int i;
String bottomFlag = "1";
String condition = "";
try
{
condition = "bottomFlag='"+bottomFlag+"'";
DBResultSet v = new DBResultSet();
v = MatKin .getMatKind(condition);
if (request.getParameter("fatKindCoder")==null)
{
System.out.println("Vector size:"+v.size());
if (v.size()>0)
{
%>
<form name="frm_select" method="POST">
<table id="tbl_select" border="0" align="center" cellspacing="0" cellpadding="0" margin="0">
<tr>
<td style="font-size:12;background-color:#e7e7e7" class=txtLTBR align="center">底层商品种类</td>
<td> <select name="fatKindCoder" onchange="kindselect()" ><%
//this.options[this.selectedIndex].value
for(i=0;i<v.size();i++)
{
%>
<option value=<%= ((MatKind)(v.get(i))).getMatKindCode()%>><%= ((MatKind)(v.get(i))).getMatKindCode()+"-"+((MatKind)(v.get(i))).getMatKindName()%></option>
<%
}
%>
</select>
</tr>
</table>
</form>
<%
}
else
{
%>
<br>
数据库里没有符合条件的数据!
<%
}
}
else
{
if (request.getParameter("matKindCoder")==null)
{
String fat = request.getParameter("fatKindCoder"); //获取底层代码
%>
<form name="frm_select" method="POST">
<table id="tbl_select" border="0" align="center" cellspacing="0" cellpadding="0" margin="0">
<tr>
<td style="font-size:12;background-color:#e7e7e7" class=txtLTBR align="center">底层商品种类</td>
<td> <select name="fatKindCoder" onchange="kindselect()"><%
//this.options[this.selectedIndex].value
for(i=0;i<v.size();i++)
{
if(((MatKind)(v.get(i))).getFatKindCode().trim().equals(request.getParameter("fatKindCoder").trim())){
out.println("<option value='"+((MatKind)(v.get(i))).getMatKindCode()+"'selected>"+((MatKind)(v.get(i))).getMatKindCode()+"-"+((MatKind)(v.get(i))).getMatKindName()+"</option>"); //out.println("<option value='"+mc2.getCompanyId()+"' selected>"+mc2.getName()+"</option>");
}else{
//out.println("<option value='"+mc2.getCompanyId()+"'>"+mc2.getName()+"</option>");
out.println("<option value='"+((MatKind)(v.get(i))).getMatKindCode()+"'>"+((MatKind)(v.get(i))).getMatKindCode()+"-"+((MatKind)(v.get(i))).getMatKindName()+"</option>");
}
}
%>
</select>
</tr><%
//从这里开始查询底层代码的下一层
bottomFlag = "0";
condition = "fatkindCode='"+fat+"' and bottomflag='"+bottomFlag+"'";
v = MatKin .getMatKind(condition);
if (v.size()>0)
{
%>
<tr>
<td style="font-size:12;background-color:#e7e7e7" class=txtLTBR align="center">一级商品种类</td>
<td > <select name="matKindCoder" onchange="kindselect()">
<%
for(i=0;i<v.size();i++)
{
%>
<option value=<%= ((MatKind)(v.get(i))).getMatKindCode()%>><%= ((MatKind)(v.get(i))).getMatKindCode()+"-"+((MatKind)(v.get(i))).getMatKindName()%></option>
<%
}
%>
</select>
</tr>
</table>
</form><%
}
}
else
{
//在此显示第三级代码
String fat = request.getParameter("fatKindCoder"); //获取底层代码
String mat =request.getParameter("matKindCoder"); //获取第一级代码
%>
<form name="frm_select" method="POST">
<table id="tbl_select" border="0" align="center" cellspacing="0" cellpadding="0" margin="0">
<tr>
<td style="font-size:12;background-color:#e7e7e7" class=txtLTBR align="center">底层商品种类</td>
<td> <select name="fatKindCoder" onchange="kindselect()" ><%
for(i=0;i<v.size();i++)
{
if(((MatKind)(v.get(i))).getFatKindCode().trim().equals(request.getParameter("fatKindCoder").trim())){
out.println("<option value='"+((MatKind)(v.get(i))).getMatKindCode()+"'selected>"+((MatKind)(v.get(i))).getMatKindCode()+"-"+((MatKind)(v.get(i))).getMatKindName()+"</option>");
}else{
out.println("<option value='"+((MatKind)(v.get(i))).getMatKindCode()+"'>"+((MatKind)(v.get(i))).getMatKindCode()+"-"+((MatKind)(v.get(i))).getMatKindName()+"</option>");
}
}
%>
</select>
</tr><%
//从这里开始查询底层代码的下一层
bottomFlag = "0";
condition = "fatkindCode='"+fat+"' and bottomflag='"+bottomFlag+"'";
//condition = "fatkindCode='"+fat+"'";
v = MatKin .getMatKind(condition);
if (v.size()>0)
{
%>
<tr>
<td style="font-size:12;background-color:#e7e7e7" class=txtLTBR align="center">一级商品种类</td>
<td> <select name="matKindCoder" onchange="kindselect()">
<%
for(i=0;i<v.size();i++)
{
if(((MatKind)(v.get(i))).getMatKindCode().trim().equals(request.getParameter("matKindCoder").trim())){
out.println("<option value='"+((MatKind)(v.get(i))).getMatKindCode()+"'selected>"+((MatKind)(v.get(i))).getMatKindCode()+"-"+((MatKind)(v.get(i))).getMatKindName()+"</option>");
}else{
out.println("<option value='"+((MatKind)(v.get(i))).getMatKindCode()+"'>"+((MatKind)(v.get(i))).getMatKindCode()+"-"+((MatKind)(v.get(i))).getMatKindName()+"</option>");
}
}
%>
</select>
</tr><%
//从这里开始查询第三层
condition = "fatkindCode='"+mat+"'";
//bottomFlag = "0";
//condition = "fatkindCode='"+fat+"' and bottomflag='"+bottomFlag+"'"; v = MatKin .getMatKind(condition);
if (v.size()>0)
{
%>
<tr>
<td style="font-size:12;background-color:#e7e7e7" class=txtLTBR align="center">二级商品种类</td>
<td> <select name="twoKindCoder" >
<%
for(i=0;i<v.size();i++)
{
%>
<option value=<%= ((MatKind)(v.get(i))).getMatKindCode()%>><%= ((MatKind)(v.get(i))).getMatKindCode()+"-"+((MatKind)(v.get(i))).getMatKindName()%></option>
<%
}
%>
</select>
</tr></table>
</form><%
}
}
}
}
}
catch(SystemEJBException e)
{
%>
<font color="red">WeblogicServer出错!</font>
<%
}
catch(SystemDMLException e)
{
%>
<font color="red">数据库读写出错!</font>
<%
}
catch(SQLException e)
{
%>
<font color="red">ORACLE 出错!</font>
<%
}
catch(Exception e)
{
%>
<font color="red">系统出错,请找管理员!</font>
<%
}
%>
</body>
</html>