标签:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page import="java.util.*" %> <%@ page import="com.hanqi.Dao.*" %> <%@ page import="com.hanqi.*" %> <!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=UTF-8"> <title>地区列表显示页面</title> <% String pid = request.getParameter("parentid"); if(pid==null||pid.trim().length()<=0) { pid = "0"; } int pid1 = Integer.parseInt(pid); //获取数据 MemberDal md = new MemberDal(); Memberclass m = md.getMemberclass(pid1); int backid = 0; if(m!=null) { backid = m.getParentId(); } %> <script src="js/jquery-1.11.3.min.js"></script> <script> $(document).ready(function () { $("#i1").click(function (){ $("#d1").toggle(100); }) }); $(document).ready($("#d1").hide()); </script> <script> function check() { var obj = /\d{6}/; //判断是否是6位数字以上的 if(fm.name.value=="") { alert("地区不能为空"); return false; } else if(!(obj.test(fm.postcode.value)||fm.postcode.value=="")) { alert("邮编请符合规则"); return false; } else { return true; } } function con(){ var cfm = confirm("确定要删除该地区吗? 删除该地区的同时, 会将该地区下的所有地区都删除! "); return cfm; } /*function show() { document.getElementById("fm").style.display="block"; }*/ function backSuper() { window.location="index.jsp?parentid=<%=backid %>"; } </script> </head> <body> 欢迎使用地区导航 <br> <br> <a href="Finder">显示全部省级地区</a> <br> <br> <input id="i1" type="button" value="在此级别添加地区" /> <input type="button" value="返回上级地区" onclick="backSuper()" /> <br> <table border="1" cellspacing="1" cellpadding="1"> <tr> <th width="80">地名</th> <th width="80">邮编</th> <th width="80">管理</th> <th width="80">删除</th> </tr> <% ArrayList<Memberclass> al = md.getList(pid1); //Memberclass u; if(al!=null) { for(Memberclass rset : al) { out.print("<tr><td>"); out.print(rset.getName()); out.print("</td><td>"); out.print(rset.getPostCode()==null?"":rset.getPostCode()); out.print("</td><td>"); out.print("<a href=‘index.jsp?parentid="+rset.getId()+"‘>下级地区</a>"); out.print("</td><td>"); out.print("<a onclick=‘return con()‘ href=‘DeleteMember?parentid="+rset.getParentId()+"&id="+rset.getId()+"‘>删除</a></td></tr>"); } } %> </table> <br> <div id="d1"> <form id="fm" method="post" action="InsertMember" onSubmit="return check()"> <input name="parentid" type="hidden" value="<%=pid%>"> <ul> <li>请输入地区: <input name="name" type="text" value="" /></li> <li>请输入邮编: <input name="postcode" type="text" value="" maxlength="6"/></li> <li><input type="submit" value="添加" /><input type="reset" value="取消" /></li> </ul> </form> </div> 带刷新的三级联动<br> <iframe src="list.jsp" width="500" height="50"></iframe><br><br> 无刷新三级联动<br> <iframe src="ajaxlist1.jsp" width="500" height="50"></iframe> </body> <script> $("#d1").hide(); </script> </html>
标签:
原文地址:http://www.cnblogs.com/wgbs25673578/p/5067907.html