- 浏览: 151333 次
- 性别:
- 来自: 深圳
文章分类
最新评论
-
hx0637:
楼主!小弟要面临面试了,能否指导下小弟?
面试 深圳一家公司的 -
kljismi:
你好,我现在正在开这项目的代码,但是我不明白@Privileg ...
权限管理模块分析 -
yzhw:
终于找到了
ImageSizer.java -
sunloveny:
国
struts国际化 -
jackotty:
谢谢楼主的分享
struts validator验证框架
index.jsp
error.jsp
item_add.jsp
item_detail.jsp
item_maint.jsp
item_modify.jsp
item_upload.jsp
windows.js
windows.js
client_validate.js
<%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%> <!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=GB18030"> <title>物料管理练习</title> </head> <body> <h1>物料管理练习</h1> <hr> <form action="user/login.do" method="post"> 用户:<input type="text" name="username"><br> 密码:<input type="password" name="password"><br> <input type="submit" value="登录"> </form> <p> <a href="basedata/changelan.do?lan=zh">中文</a>  <a href="basedata/changelan.do?lan=en">英文</a><br> </body> </html>
error.jsp
<%@ page contentType="text/html;charset=GB18030"%> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%> <html> <head> <title>错误信息!</title> <meta http-equiv="content-type" content="text/html;charset=gb2312"> <style type="text/css"> <!-- .STYLE1 { font-size: 24px; font-weight: bold; color: #FF0000; } --> </style> </head> <body> <br> <br> <center> <table width="500"> <tr> <td align="center"> <p align="left"> <span class="STYLE1">错误信息:</span> </td> </tr> </table> <hr> <table width="500"> <tr> <td> <html:errors/> </td> </tr> <tr> <td align="center" colspan="2"> <input type="button" name="goback" value="返回" onClick="javascript:history.go(-1);"> </td> </tr> </table> </center> </body> </html>
item_add.jsp
<%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@ taglib prefix="drp" uri="http://www.bjsxt.com/drp/functions"%> <%@ taglib prefix="bean" uri="http://struts.apache.org/tags-bean" %> <html> <head><meta http-equiv="Content-Type" content="text/html; charset=GB18030"> <title></title> <link rel="stylesheet" href="../style/drp.css"> <script src="../script/client_validate.js"></script> <script type="text/javascript"> function addItem() { if (trim(document.getElementById("itemNo").value) == "") { alert("物料代码不能为空!"); document.getElementById("itemNo").focus(); return; } if (trim(document.getElementById("itemName").value) == "") { alert("物料名称不能为空!"); document.getElementById("itemName").focus(); return; } with (document.getElementById("itemForm")) { method = "post"; action = "item.do?command=add&pageNo=${itemForm.pageNo}&pageSize=${itemForm.pageSize}"; submit(); } } function goBack() { window.self.location = "item.do?command=list&pageNo=${itemForm.pageNo}&pageSize=${itemForm.pageSize}"; } </script> </head> <body class="body1"> <form name="itemForm" target="_self" id="itemForm"> <div align="center"> <table width="95%" border="0" cellspacing="2" cellpadding="2"> <tr> <td> </td> </tr> </table> <table width="95%" border="0" cellspacing="0" cellpadding="0" height="25"> <tr> <td width="522" class="p1" height="25" nowrap><img src="../images/mark_arrow_03.gif" width="14" height="14"> <b><bean:message key="drp.basedata"/>>><bean:message key="drp.basedata.item"/>>><bean:message key="drp.button.add"/></b></td> </tr> </table> <hr width="97%" align="center" size=0> <table width="95%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="22%" height="29"> <div align="right"><font color="#FF0000">*</font><bean:message key="drp.basedata.item.itemNo"/>: </div></td> <td width="78%"><input name="itemNo" type="text" class="text1" id="itemNo" size="10" maxlength="10"></td> </tr> <tr> <td height="26"><div align="right"><font color="#FF0000">*</font><bean:message key="drp.basedata.item.itemName"/>: </div></td> <td><input name="itemName" type="text" class="text1" id="itemName" size="20" maxlength="20"></td> </tr> <tr> <td height="26"><div align="right"><bean:message key="drp.basedata.item.spec"/>: </div></td> <td><label> <input name="spec" type="text" class="text1" id="spec" size="20" maxlength="20"> </label></td> </tr> <tr> <td height="26"> <div align="right"><bean:message key="drp.basedata.item.pattern"/>: </div></td> <td><input name="pattern" type="text" class="text1" id="pattern" size="20" maxlength="20"> </td> </tr> <tr> <td height="26"><div align="right"><font color="#FF0000">*</font><bean:message key="drp.basedata.item.category"/>: </div></td> <td><select name="categoryId" class="select1" id="categoryId"> <c:forEach items="${drp:getItemCategoryList()}" var="ic" > <option value="${ic.id}">${ic.name}</option> </c:forEach> </select></td> </tr> <tr> <td height="26"><div align="right"><font color="#FF0000">*</font><bean:message key="drp.basedata.item.unit"/>: </div></td> <td><select name="unitId" class="select1" id="unitId"> <c:forEach items="${drp:getItemUnitList()}" var="iu" > <option value="${iu.id}">${iu.name}</option> </c:forEach> </select></td> </tr> </table> <hr width="97%" align="center" size=0> <div align="center"> <input name="btnAdd" class="button1" type="button" id="btnAdd" value="<bean:message key="drp.button.add"/>" onclick="addItem()" > <input name="" class="button1" type="button" id="btnBack" value="<bean:message key="drp.button.goback"/>" onClick="goBack()"> </div> </div> </form> </body> </html>
item_detail.jsp
<%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%> <%@ taglib prefix="bean" uri="http://struts.apache.org/tags-bean" %> <html> <head> <title></title> <link rel="stylesheet" href="../style/drp.css"> <script src="../script/client_validate.js"></script> <script language="javascript"> </script> </head> <body class="body1"> <form name="itemForm" target="_self" id="itemForm"> <div align="center"> <table width="95%" border="0" cellspacing="2" cellpadding="2"> <tr> <td> </td> </tr> </table> <table width="95%" border="0" cellspacing="0" cellpadding="0" height="8"> <tr> <td width="522" class="p1" height="25" nowrap><img src="../images/mark_arrow_03.gif" width="14" height="14"> <b><bean:message key="drp.basedata"/>>><bean:message key="drp.basedata.item"/>>><bean:message key="drp.basedata.item.title"/></b></td> </tr> </table> <hr width="97%" align="center" size=0> <table width="95%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="22%" height="29"><div align="right"><bean:message key="drp.basedata.item.itemNo"/>: </div></td> <td width="78%">${ item.itemNo }</td> </tr> <tr> <td height="26"><div align="right"><bean:message key="drp.basedata.item.itemName"/>: </div></td> <td>${ item.itemName }</td> </tr> <tr> <td height="26"><div align="right"><bean:message key="drp.basedata.item.spec"/>: </div></td> <td>${ item.spec }</td> </tr> <tr> <td height="26"><div align="right"><bean:message key="drp.basedata.item.pattern"/>: </div></td> <td>${ item.pattern }</td> </tr> <tr> <td height="26"><div align="right"><bean:message key="drp.basedata.item.category"/>: </div></td> <td>${ item.category.name }</td> </tr> <tr> <td height="26"><div align="right"><bean:message key="drp.basedata.item.unit"/>: </div></td> <td>${ item.unit.name }</td> </tr> <tr> <td height="74"><div align="right"><bean:message key="drp.basedata.item.image"/>: </div></td> <td><img src="../images/item/${ item.itemNo }.gif" width="85" height="49"></td> </tr> </table> <hr width="97%" align="center" size=0> <div align="center"> <input name="btnClose" class="button1" type="button" id="btnClose" value="<bean:message key="drp.button.colse"/>" onClick="window.close()"> </div> </div> </form> </body> </html>
item_maint.jsp
<%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@ taglib prefix="bean" uri="http://struts.apache.org/tags-bean" %> <html> <head><meta http-equiv="Content-Type" content="text/html; charset=GB18030"> <title></title> <link rel="stylesheet" href="../style/drp.css"> <script src="../script/windows.js"></script> <script type="text/javascript"> function addItem() { window.self.location = "additem.do?pageNo=${itemForm.pageNo}&pageSize=${itemForm.pageSize}"; } function modifyItem() { var count = 0; var j = 0; for (var i = 0; i < document.getElementsByName("selectFlag").length; i++) { if (document.getElementsByName("selectFlag")[i].checked) { j = i; count++; } } if (count == 0) { alert("请选择需要修改的物料!"); return; } if (count > 1) { alert("一次只能修改一个物料!"); return; } if (count == 1) { window.self.location = "item.do?command=modifyDetail&itemNo=" + document.getElementsByName("selectFlag")[j].value + "&pageNo=${itemForm.pageNo}&pageSize=${itemForm.pageSize}"; } } function deleteItem() { var flag = false; for (var i = 0; i < document.getElementsByName("selectFlag").length; i++) { if (document.getElementsByName("selectFlag")[i].checked) { flag = true; } } if (!flag) { alert("请选择需要删除的物料!"); return; } if (window.confirm("确认删除吗?")) { with (document.getElementById("itemForm")) { method = "post"; action = "item.do?command=del&pageNo=${itemForm.pageNo}&pageSize=${itemForm.pageSize}"; submit(); } } } function checkAll() { for (var i = 0; i < document.getElementsByName("selectFlag").length; i++) { document.getElementsByName("selectFlag")[i].checked = document.getElementById("ifAll").checked; } } function uploadPic4Item() { var count = 0; var j = 0; for (var i = 0; i < document.getElementsByName("selectFlag").length; i++) { if (document.getElementsByName("selectFlag")[i].checked) { j = i; count++; } } if (count == 0) { alert("请选择需要上传的物料!"); return; } if (count > 1) { alert("一次只能上传一个物料!"); return; } window.self.location = "item.do?command=uploadDetail&itemNo=" + document.getElementsByName("selectFlag")[j].value + "&pageNo=${itemForm.pageNo}&pageSize=${itemForm.pageSize}";; } function queryItem() { with (document.getElementById("itemForm")) { method = "post"; action = "item.do?command=list&pageNo=1&pageSize=${itemForm.pageSize}"; submit(); } } function resetItem() { document.getElementsByName("clientIdOrName").value = ""; } function topPage() { window.self.location = "item.do?command=list&pageNo=${pagemodel.topPageNo}&pageSize=${itemForm.pageSize}&clientIdOrName=${ itemForm.clientIdOrName }" } function previousPage() { window.self.location = "item.do?command=list&pageNo=${pagemodel.previousPageNo}&pageSize=${itemForm.pageSize}&clientIdOrName=${ itemForm.clientIdOrName }" } function nextPage() { window.self.location = "item.do?command=list&pageNo=${pagemodel.nextPageNo}&pageSize=${itemForm.pageSize}&clientIdOrName=${ itemForm.clientIdOrName }" } function bottomPage() { window.self.location = "item.do?command=list&pageNo=${pagemodel.bottomPageNo}&pageSize=${itemForm.pageSize}&clientIdOrName=${ itemForm.clientIdOrName }" } function myOnkeypress() { if (window.event.keyCode == 13) { queryItem(); } } </script> </head> <body class="body1"> <form name="itemForm" id="itemForm"> <div align="center"> <table width="95%" border="0" cellspacing="2" cellpadding="2"> <tr> <td> </td> </tr> </table> <table width="95%" border="0" cellspacing="0" cellpadding="0" height="8"> <tr> <td width="522" class="p1" height="2" nowrap><img src="../images/mark_arrow_02.gif" width="14" height="14"> <b><bean:message key="drp.basedata"/>>><bean:message key="drp.basedata.item"/></b></td> </tr> </table> <hr width="97%" align="center" size=0> <table width="95%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="17%" height="29"> <div align="left"><bean:message key="drp.basedata.item.itemNo"/>/<bean:message key="drp.basedata.item.itemName"/>:</div></td> <td width="46%"><input name="clientIdOrName" type="text" class="text1" id="clientIdOrName" value="${ itemForm.clientIdOrName }" size="50" maxlength="50" onKeyPress="myOnkeypress()"> </td> <td width="37%"> <div align="left"> <input name="btnQuery" type="button" class="button1" id="btnQuery" value="<bean:message key="drp.button.query"/>" onClick="queryItem()"> <input name="btnReset" type="button" class="button1" id="btnReset" value="<bean:message key="drp.button.reset"/>" onClick="resetItem()"> </div></td> </tr> <tr> <td height="16"> <div align="right"></div></td> <td> </td> <td><div align="right"></div></td> </tr> </table> </div> <table width="95%" border="0" cellspacing="0" cellpadding="0" class="rd1" align="center"> <tr> <td nowrap height="10" class="p2"><bean:message key="drp.basedata.item.title"/></td> <td nowrap height="10" class="p3"> </td> </tr> </table> <table width="95%" border="1" cellspacing="0" cellpadding="0" align="center" class="table1"> <tr> <td width="35" class="rd6"><input type="checkbox" name="ifAll" onClick="checkAll()" ></td> <td width="170" class="rd6"><bean:message key="drp.basedata.item.itemNo"/></td> <td width="222" class="rd6"><bean:message key="drp.basedata.item.itemName"/></td> <td width="195" class="rd6"><bean:message key="drp.basedata.item.spec"/></td> <td width="293" class="rd6"><bean:message key="drp.basedata.item.pattern"/></td> <td width="293" class="rd6"><bean:message key="drp.basedata.item.category"/></td> <td width="293" class="rd6"><bean:message key="drp.basedata.item.unit"/></td> </tr> <c:forEach items="${pagemodel.list}" var="item"> <tr> <td width="35" class="rd8" ><input type="checkbox" name="selectFlag" id="selectFlag" class="checkbox1" value="${item.itemNo }"></td> <td width="170" class="rd8" ><a href="item.do?command=list&pageNo=${itemForm.pageNo}&pageSize=${itemForm.pageSize}" onClick="window.open('item.do?command=findDetail&itemNo=${item.itemNo}', '物料详细信息', 'width=450, height=400, scrollbars=no')">${ item.itemNo }</a></td> <td width="222" class="rd8" >${ item.itemName }</td> <td width="195" class="rd8" >${ item.spec }</td> <td width="293" class="rd8" >${ item.pattern }</td> <td width="293" class="rd8" >${ item.category.name }</td> <td width="293" class="rd8" >${ item.unit.name }</td> </tr> </c:forEach> </table> <table width="95%" height="30" border="0" align="center" cellpadding="0" cellspacing="0" class="rd1"> <tr> <td nowrap class="rd19" height="2" width="36%"> <div align="left"><font color="#FFFFFF"> <bean:message key="drp.page.totalPages"/>: ${pagemodel.totalPages }</font> <font color="#FFFFFF"><bean:message key="drp.page.currentPage"/>:</font> <font color="#FF0000">${pagemodel.pageNo }</font> <font color="#FFFFFF"></font> </div></td> <td nowrap class="rd19" width="64%"> <div align="right"> <input name="btnTopPage" class="button1" type="button" id="btnTopPage" value="|<< " title="<bean:message key="drp.button.topPage"/>" onClick="topPage()"> <input name="btnPreviousPage" class="button1" type="button" id="btnPreviousPage" value=" < " title="<bean:message key="drp.button.previousPage"/>" onClick="previousPage()"> <input name="btnNext" class="button1" type="button" id="btnNext" value=" > " title="<bean:message key="drp.button.nextPage"/>" onClick="nextPage()"> <input name="btnBottomPage" class="button1" type="button" id="btnBottomPage" value=" >>|" title="<bean:message key="drp.button.bottomPage"/>" onClick="bottomPage()"> <input name="btnAdd" type="button" class="button1" id="btnAdd" value="<bean:message key="drp.button.add"/>" onClick="addItem()"> <input name="btnDelete" class="button1" type="button" id="btnDelete" value="<bean:message key="drp.button.delete"/>" onClick="deleteItem()"> <input name="btnModify" class="button1" type="button" id="btnModify" value="<bean:message key="drp.button.modify"/>" onClick="modifyItem()"> <input name="btnUpload" class="button1" type="button" id="btnUpload" value="<bean:message key="drp.button.uploadImage"/>" onClick="uploadPic4Item()"> </div></td> </tr> </table> </form> </body> </html>
item_modify.jsp
<%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@ taglib prefix="drp" uri="http://www.bjsxt.com/drp/functions"%> <%@ taglib prefix="bean" uri="http://struts.apache.org/tags-bean" %> <html> <head><meta http-equiv="Content-Type" content="text/html; charset=GB18030"> <title></title> <link rel="stylesheet" href="../style/drp.css"> <script src="../script/client_validate.js"></script> <script type="text/javascript"> function modifyItem() { if (trim(document.getElementById("itemName").value) == "") { alert("物料名称不能为空!"); document.getElementById("itemName").focus(); return; } with (document.getElementById("itemForm")) { method = "post"; action = "item.do?command=modify&pageNo=${itemForm.pageNo}&pageSize=${itemForm.pageSize}"; submit(); } } function goBack() { window.self.location = "item.do?command=list&pageNo=${itemForm.pageNo}&pageSize=${itemForm.pageSize}"; } </script> </head> <body class="body1"> <form name="itemForm" id="itemForm"> <div align="center"> <table width="95%" height="21" border="0" cellpadding="2" cellspacing="2"> <tr> <td> </td> </tr> </table> <table width="95%" border="0" cellspacing="0" cellpadding="0" height="25"> <tr> <td width="522" class="p1" height="25" nowrap><img src="../images/mark_arrow_03.gif" width="14" height="14"> <b><bean:message key="drp.basedata"/>>><bean:message key="drp.basedata.item"/>>><bean:message key="drp.button.modify"/></b></td> </tr> </table> <hr width="97%" align="center" size=0> <table width="95%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="22%" height="29"> <div align="right"><bean:message key="drp.basedata.item.itemNo"/>: </div></td> <td width="78%"><input name="itemNo" type="text" class="text1" id="itemNo" value="${ item.itemNo }" size="10" maxlength="10" readonly="true" ></td> </tr> <tr> <td height="26"><div align="right"><font color="#FF0000">*</font><bean:message key="drp.basedata.item.itemName"/>: </div></td> <td><input name="itemName" type="text" class="text1" id="itemName" value="${ item.itemName }" size="20" maxlength="20"></td> </tr> <tr> <td height="26"><div align="right"><bean:message key="drp.basedata.item.spec"/>: </div></td> <td><label> <input name="spec" type="text" class="text1" id="spec" value="${ item.spec }" size="20" maxlength="20"> </label></td> </tr> <tr> <td height="26"> <div align="right"><bean:message key="drp.basedata.item.pattern"/>: </div></td> <td><input name="pattern" type="text" class="text1" id="pattern" value="${ item.pattern }" size="20" maxlength="20"> </td> </tr> <tr> <td height="26"><div align="right"><font color="#FF0000">*</font><bean:message key="drp.basedata.item.category"/>: </div></td> <td><select name="categoryId" class="select1" id="categoryId"> <c:forEach items="${drp:getItemCategoryList()}" var="ic" > <c:set var="select" value=""/> <c:if test="${ ic.id eq item.category.id}"> <c:set var="select" value="selected"/> </c:if> <option value="${ic.id}" ${ select }>${ic.name}</option> </c:forEach> </select></td> </tr> <tr> <td height="26"><div align="right"><font color="#FF0000">*</font><bean:message key="drp.basedata.item.unit"/>: </div></td> <td><select name="unitId" class="select1" id="unitId"> <c:forEach items="${drp:getItemUnitList()}" var="iu" > <c:set var="select" value=""/> <c:if test="${ iu.id eq item.unit.id }"> <c:set var="select" value="selected"/> </c:if> <option value="${iu.id}" ${ select }>${iu.name}</option> </c:forEach> </select></td> </tr> </table> <hr width="97%" align="center" size=0> <div align="center"> <input name="btnModify" class="button1" type="button" id="btnModify" value="<bean:message key="drp.button.modify"/>" onClick="modifyItem()"> <input name="btnBack" class="button1" type="button" id="btnBack" value="<bean:message key="drp.button.goback"/>" onClick="goBack()"> </div> </div> </form> </body> </html>
item_upload.jsp
<%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%> <%@ taglib prefix="bean" uri="http://struts.apache.org/tags-bean" %> <html> <head> <title></title> <link rel="stylesheet" href="../style/drp.css"> <script src="../script/client_validate.js"></script> <script language="javascript"> function upload() { with (document.getElementById("itemForm")) { method = "post"; action = "item.do?command=upload&pageNo=${itemForm.pageNo}&pageSize=${itemForm.pageSize}"; submit(); } } function goBack() { window.self.location = "item.do?command=list&pageNo=${itemForm.pageNo}&pageSize=${itemForm.pageSize}"; } </script> </head> <body class="body1"> <form name="itemForm" id="itemForm" enctype="multipart/form-data"> <input type="hidden" name="itemNo" value="${ item.itemNo }"> <div align="center"> <table width="95%" border="0" cellspacing="2" cellpadding="2"> <tr> <td> </td> </tr> </table> <table width="95%" border="0" cellspacing="0" cellpadding="0" height="8"> <tr> <td width="522" class="p1" height="25" nowrap><img src="../images/mark_arrow_03.gif" width="14" height="14"> <b><bean:message key="drp.basedata"/>>><bean:message key="drp.basedata.item"/>>><bean:message key="drp.button.uploadImage"/></b></td> </tr> </table> <hr width="97%" align="center" size=0> <table width="95%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="22%" height="29"><div align="right"><bean:message key="drp.basedata.item.itemNo"/>: </div></td> <td width="78%">${ item.itemNo }</td> </tr> <tr> <td height="26"><div align="right"><bean:message key="drp.basedata.item.itemName"/>: </div></td> <td>${ item.itemName }</td> </tr> <tr> <td height="26"><div align="right"><bean:message key="drp.basedata.item.spec"/>: </div></td> <td>${ item.spec }</td> </tr> <tr> <td height="26"><div align="right"><bean:message key="drp.basedata.item.pattern"/>: </div></td> <td>${ item.pattern }</td> </tr> <tr> <td height="26"><div align="right"><bean:message key="drp.basedata.item.category"/>: </div></td> <td>${ item.category.name }</td> </tr> <tr> <td height="26"><div align="right"><bean:message key="drp.basedata.item.unit"/>: </div></td> <td>${ item.unit.name }</td> </tr> <tr> <td height="74"><div align="right"><bean:message key="drp.basedata.item.image"/>: </div></td> <td><img src="../images/item/${ item.itemNo }.gif" width="85" height="49"></td> </tr> <tr> <td width="22%" height="29"> <div align="right"><font color="#FF0000">*</font><bean:message key="drp.basedata.item.selectimage"/>: </div></td> <td width="78%"><input name="fileName" type="file" class="text1" id=""uploadFile"" size="40" maxlength="40"> </td> </tr> </table> <hr width="97%" align="center" size=0> <div align="center"> <input name="btnUpload" class="button1" type="button" id="btnUpload" value="<bean:message key="drp.button.uploadImage"/>" onClick="upload()" > <input name="btnBack" class="button1" type="button" id="btnBack" value="<bean:message key="drp.button.goback"/>" onClick="goBack()"> </div> </div> </form> </body> </html>
windows.js
function over_change(src) { if (!src.contains(event.fromElement)) { src.style.cursor="hand"; } } function out_change(src) { if (!src.contains(event.toElement)) { src.style.cursor = "default"; } }
windows.js
<!-- <!-- /** * * JSCalendar * * Author :H.Z. Shang (Jack) * Email :shhongzhang@cntomorrow.com * Site :http://www.cntomorrow.com:3310 * Version :1.0.1 * Finished Date :2003-3-2 * Beijing Huasun Mingtian Tech. Co., Ltd. * No CopyRight,Can be modified by you if you want improve it's function!!!! * LET'S MAKE IT BETTER TOGETHER! * HISTORY: * 1. [2003-3-4 by Jack] 采用IFRAME修正了会被页面SELECT对象挡住的BUG! * 2. [2003-3-4 by Jack] 增加了清空控件值的功能 * 3. [2003-3-5 by Jack] 修正了当用户翻年、翻月时原输入框值被覆盖的情况 * 4. [2003-3-5 by Jack] 通过使用DXImageTransform.Microsoft.Shadow来实现IFRAME的阴影效果 * 该滤镜只能在IE5.5下使用可加快程序运行速度,在IE5.0中还是使用原来的产生阴影的方法 * 5. [2003-3-6 by Jack] 增加了另外一种生成该控件的方法:<script>createDateBox("Name", "2003-3-6")</script> * 其中第二个参数为可选参数 */ var _cldTabIFrame = null; var _cldTabIFrame2 = null; var _cldTabFrm = null; var _cldMonthMenuFrm = null; var _curCldTabRltvObj = null; var _bCanHide = true; var _bHaveUpdated = false; var _bHaveShown = false; var _bHaveSelectNewValue = false; var _dCurYear = null; var _dCurMonth = null; var _dCurDate = null; var _curCldTabRltvObjValue = ""; /** * 在该日历控件中,我采用了给空间周围加上阴影层来增强控件的视觉感。 * _nShadowLength 变量设定了阴影层的长度,默认值为 4; * 使用阴影层将相应的滞缓程序的运行速度,如果你想得到较快的运行速度,请将该值设为 0 */ var _nShadowLength = 0; /** * _sNeededFilePath 变量设定了JSCalendar控件所需的所有文件的位置 * 当你将你的应用部署到应用服务器上后,你需要给改变量设定相应的值。 * 例如: * _sNeededFilePath = "/MyWebAPP/comm/js/JSCalendar/"; * * 该变量的值必须正确设置,否则程序在运行中可能出现错误! */ var _sNeededImagesFilePath = "../images/"; var _sNeededCSSFilePath = "../style/"; var _sBrowserVersion = navigator.appVersion.substring(navigator.appVersion.indexOf("MSIE") + 5,navigator.appVersion.indexOf("Windows") - 2); var _bBrowserVer55 = _sBrowserVersion >= 5.5 ? true : false; /** * 定义所需图片 * */ var _imgReset1 = new Image(); _imgReset1.src = _sNeededImagesFilePath + "reset1.gif"; var _imgReset2 = new Image(); _imgReset2.src = _sNeededImagesFilePath + "reset2.gif"; var _imgBtnYear = new Image(); _imgBtnYear.src = _sNeededImagesFilePath + "btnYears.gif"; var _imgBgToday1 = new Image(); _imgBgToday1.src = _sNeededImagesFilePath + "bgToday1.gif"; var _monthDays = new Array(12); _monthDays[ 0] = 31; _monthDays[ 1] = 28; _monthDays[ 2] = 31; _monthDays[ 3] = 30; _monthDays[ 4] = 31; _monthDays[ 5] = 30; _monthDays[ 6] = 31; _monthDays[ 7] = 31; _monthDays[ 8] = 30; _monthDays[ 9] = 31; _monthDays[10] = 30; _monthDays[11] = 31; var _weeks = new Array(7); _weeks[0] = "日"; _weeks[1] = "一"; _weeks[2] = "二"; _weeks[3] = "三"; _weeks[4] = "四"; _weeks[5] = "五"; _weeks[6] = "六"; var _months = new Array(12); _months[ 0] = "一月"; _months[ 1] = "二月"; _months[ 2] = "三月"; _months[ 3] = "四月"; _months[ 4] = "五月"; _months[ 5] = "六月"; _months[ 6] = "七月"; _months[ 7] = "八月"; _months[ 8] = "九月"; _months[ 9] = "十"; _months[10] = "十一月"; _months[11] = "十二月"; var _dftD = new Date(); document.write("<IFRAME id=frm name=frm style='display:none'></IFRAME>"); function JSCalendar(rltvO, year, month, date){ if(_bHaveUpdated && rltvO == _curCldTabRltvObj) return; if(rltvO.tagName != "INPUT"){alert("JSCalendar 1.0 alerts you:\n\n INPUT element(object) must be required!");return}; hideCldTabFrm(); //rltvO.readOnly = true; rltvO.style.cursor = "default"; rltvO.style.textAlign = "center"; _curCldTabRltvObjValue = rltvO.value; _bHaveSelectNewValue = false; //------------------------------------------------------------------------------ this.createCldTabFrm = createCldTabFrm; this.fillCldTabFrm = fillCldTabFrm; this.placeCldTabFrm = placeCldTabFrm; //------------------------------------------------------------------------------ this._rltvO = (rltvO == null ? document.body : rltvO); var _oldDate = rltvO.value; var _oldDateType = "From Input!"; try{ if(_oldDate == "") throw ""; var d = _oldDate.split("-"); var _tmpDate = getValidateDate(_oldDate); this._year = _tmpDate.getFullYear(); this._month = _tmpDate.getMonth(); this._date = _tmpDate.getDate(); }catch(e){ _debug("Error was be catched:" + e.description); _oldDateType = "From default or current date!"; this._year = (year == null ? _dftD.getFullYear() : year); this._month = (month == null ? _dftD.getMonth() : month - 1);; this._date = (date == null ? _dftD.getDate() : date); } //alert(this._year + "-" + (this._month + 1) + "-" + this._date ); _dCurYear = this._year; _dCurMonth = this._month; _dCurDate = this._date; if(_cldTabIFrame == null) this.createCldTabFrm(); //alert(_cldTabIFrame2) _cldTabIFrame2.style.display = "inline"; _debug(_oldDateType + "[]" + this._year + "-" + (this._month + 1) + "-" + this._date); this.fillCldTabFrm(this._year, this._month, this._date); if(!_bHaveShown || rltvO != _curCldTabRltvObj) this.placeCldTabFrm(); //_cldTabIFrame2.style.display = "inline"; if(!_bBrowserVer55){ removeShadowDiv(); MakeDivShadowEffect(_cldTabFrm, '#aaaaaa', _nShadowLength); } _curCldTabRltvObj = this._rltvO; _bHaveUpdated = true; _bHaveShown = true; } function createCldTabFrm(){ var _sz = "<HTML>" + "<HEAD><link href='" +_sNeededCSSFilePath + "JSCalendar.css' rel=stylesheet type='text/css'></HEAD>" + "<BODY onselectstart='return false;' leftmargin=0 topmargin=0 rightmargin=0 bottommargin=0 style='cursor:default;background-color:transparent;border:0px solid black;scroll:no'>" + "</BODY></HTML>"; _cldTabIFrame = frm;//document.all("frm");//document.createElement("IFRAME"); _cldTabIFrame2 = document.all("frm"); _cldTabIFrame2.style.position = "absolute"; //_cldTabIFrame2.document.body.scroll = "no"; //_cldTabIFrame2.style.pixelWidth = /*_innerTabFrmRect.right - _innerTabFrmRect.left*/ //375 + _nShadowLength; //_cldTabIFrame2.style.pixelHeight = /*_innerTabFrmRect.bottom - _innerTabFrmRect.top*/ 165 + _nShadowLength; //_cldTabIFrame2.allowTransparency = true; if(_bBrowserVer55) _cldTabIFrame2.style.filter = "progid:DXImageTransform.Microsoft.Shadow(direction=135,color=#aaaaaa,strength=" + _nShadowLength + ")"; _cldTabIFrame.document.open("text/html","replace"); _cldTabIFrame.document.write(_sz); _cldTabIFrame.document.close(); _cldTabFrm = _cldTabIFrame.document.createElement("TABLE"); _cldTabFrm.id = "JACKSHANGJIELOVEFEIFEI" _cldTabFrm.style.position = "absolute"; _cldTabFrm.className = "calendar"; _cldTabFrm.border = 0; _cldTabFrm.height = 165; _cldTabFrm.style.pixelWidth = 220; _cldTabFrm.cellSpacing = 1; _cldTabFrm.cellPadding = 1; _cldTabFrm.bgColor = "ffffff"; _cldTabFrm.attachEvent("onmouseover", whenMouseOverCldTabFrm); _cldTabFrm.attachEvent("onmouseout", whenMouseOutCldTabFrm); // Create Calendar Control header var _TR = _cldTabFrm.insertRow(); var _TD = _TR.insertCell(); _TD.colSpan = 7; _TD.align = "center"; _TD.innerHTML = " ";//"<b>JS Calendar 1.0 by Jack</b>"; // Create main block for(var i = 0; i < 7; i++){ _TR = _cldTabFrm.insertRow(); for(var j = 0; j < 7; j++){ _TD = _TR.insertCell(); _TD.style.cursor = "default"; _TD.align = "center"; _TD.width = 50; //_TD.style.border = "1px solid black"; _TD.innerHTML = "*"; if(i != 0){ _TD.style.cursor = "hand"; _TD.attachEvent("onmouseover", whenMouseOverDateItem); _TD.attachEvent("onmouseout", whenMouseOutDateItem); _TD.attachEvent("onclick", whenClickDateItem); } if(i == 0) _TD.innerHTML = "<b>" + _weeks[j] + "</b>"; if(i == 0 && (j == 0 || j == 6)) _TD.className = "tdHoliday"; } } // Create footer _TR = _cldTabFrm.insertRow(2); _TD = _TR.insertCell(); _TD.colSpan = 7; _TD.height = 1; _TD.bgColor = "black"; _TR = _cldTabFrm.insertRow(); _TD = _TR.insertCell(); _TD.colSpan = 7; _TD.innerHTML = "<table cellspacing=0 cellpadding=0 class=calendar style='border:0px solid;width:100%'>" + "<tr><td title= '选择今天'style='cursor:hand'onclick=\"parent._bHaveSelectNewValue=true;parent.setTargetFormaValue(" + _dftD.getFullYear() + "," + (_dftD.getMonth() + 1) + "," + _dftD.getDate() + ");parent.hideCldTabFrm();return;parent.fillCldTabFrm(" + _dftD.getFullYear() + "," + _dftD.getMonth() + "," + _dftD.getDate() + ");\">" + "<b> <img src='" + _imgBgToday1.src + "' width=30px>今天: " + _dftD.getFullYear() + "-" + (_dftD.getMonth() + 1) + "-" + _dftD.getDate() + "</td>" + "<td width=30px>" + "<img style='cursor:hand' onclick=parent.resetTargetValue() title='Reset the target value.' src='" + _imgReset1.src + "' onmouseover=this.src='" + _imgReset2.src + "' onmouseout=this.src='" + _imgReset1.src + "'></td>" + "<td align=right class=smallFont></td></tr></table>"; _cldTabIFrame.document.body.insertBefore(_cldTabFrm); } function fillCldTabFrm(year, month, date){ //return; var dCurDate = 0; var dNextMonthDate = 1; var iDateStartRow = 3; //var _d = new Date(this._year, this._month, 1); var _d = new Date(year, month, 1); //alert(year + "-" + month + "-" + date); var _day = _d.getDay(); var _td = null; _dCurYear = year; _dCurMonth = month; _dCurDate = date; if (((_dCurYear % 4 == 0) && !(_dCurYear % 100 == 0)) ||(_dCurYear % 400 == 0)) _monthDays[1] = 29; else _monthDays[1] = 28; _cldTabFrm.rows(0).cells(0).innerHTML = "<table bgcolor=420042 class=calendar style=\"color:white;font-weight:bolder;border:0px solid;width:100%;height:20px;\" cellspacing=0 cellpadding=0>" + "<tr><td>" + " <a style='cursor:hand' title='Last Month' onclick=\"parent.switchLastMonth()\"><<</a>" + "</td>" + "<td align=center vAlign=middle>" + "<map name=mapForBtnYears><area title='Next Year' onclick=parent.switchLastYear() shape=rect coords=0,0,10,5><area title='Last Year' onclick=parent.switchNextYear() shape=rect coords=0,5,10,15></map>" + "" + _months[_dCurMonth] + " , " + _dCurYear + " <img border=0 align=absMiddle src='" + _imgBtnYear.src + "' style='height:12px;width:10px' usemap=#mapForBtnYears> " + "</td>" + "<td align=right>" + "<a style='cursor:hand' title='Next Month' onclick=\"parent.switchNextMonth()\">>></a> " + "</td></tr></table>" _day = (_day == 0 ? 7 : _day); for(var i = _day - 1, dlt = 0; i >= 0; i--){ _td = _cldTabFrm.rows(iDateStartRow).cells(i); //_td.disabled = true; _td.className = "lastMonth"; _td.title = ""; _td.name = "LASTMONTH"; _td.style.backgroundColor = "transparent"; _td.style.border = "0px solid"; var _nextMonth = _dCurMonth - 1; if(_nextMonth < 0) _nextMonth = 11; _td.innerText = (_monthDays[_nextMonth] - (dlt++)); } //alert(_cldTabFrm.rows.length); i = _day; for(var d = 1, iRow = iDateStartRow; d <= _monthDays[_dCurMonth] || iRow < 9; ){ for(; i < 7; i++){ dCurDate = d++; _td = _cldTabFrm.rows(iRow).cells(i); _td.disabled = false; _td.className = "normal"; _td.name = "CURRENTMONTH"; _td.style.backgroundColor = "transparent"; _td.style.border = "0px solid"; if(i == 0 || i == 6) _td.className = "tdHoliday"; if(d - 1 > _monthDays[_dCurMonth]){ dCurDate = dNextMonthDate++; //_td.disabled = true; _td.className = "nextMonth"; _td.name = "NEXTMONTH"; } //if(dCurDate < 10) dCurDate = "0" + dCurDate; _td.innerHTML = dCurDate; if(dCurDate == _dCurDate && _td.name == "CURRENTMONTH"){ //_cldTabFrm.rows(iRow).cells(i).style.backgroundColor = "620662"; //_cldTabFrm.rows(iRow).cells(i).background = "bgCurDate.gif"; _cldTabFrm.rows(iRow).cells(i).className = "tdCurDate"; } if(dCurDate == _dftD.getDate() && _dCurMonth == _dftD.getMonth() && _dCurYear == _dftD.getFullYear() && _td.name == "CURRENTMONTH"){ _cldTabFrm.rows(iRow).cells(i).className = "tdToday"; if(dCurDate == _dCurDate) _cldTabFrm.rows(iRow).cells(i).className = "tdTodayCurDate"; } if(dCurDate == _dftD.getDate() && dCurDate == _dCurDate && _td.name == "CURRENTMONTH"){ //_td.style.backgroundColor = "#663366"; //_td.style.border = "1px solid gray"; //_cldTabFrm.rows(iRow).cells(i).className = "tdTodayCurDate"; } } i = 0; iRow++; } } function placeCldTabFrm(){ var _rect = this._rltvO.getBoundingClientRect(); var _bodyWidth = document.body.clientWidth; var _bodyHeight = document.body.clientHeight; var _tmp = _cldTabIFrame; //alert(_bodyHeight); _cldTabIFrame = _cldTabIFrame2; var _innerTabFrmRect = _cldTabFrm.getBoundingClientRect(); //_debug(_innerTabFrmRect.right + "," + _innerTabFrmRect.left) _cldTabIFrame2.style.pixelWidth = /*_innerTabFrmRect.right - _innerTabFrmRect.left*/ 220 + (_bBrowserVer55 ? 0 : _nShadowLength); _cldTabIFrame2.style.pixelHeight = /*_innerTabFrmRect.bottom - _innerTabFrmRect.top*/ 165+ (_bBrowserVer55 ? 0 : _nShadowLength); _cldTabIFrame.style.pixelLeft = _rect.left - 2 + document.body.scrollLeft; _cldTabIFrame.style.pixelTop = _rect.bottom - 2 + document.body.scrollTop; var _cldTabFrmRect = _cldTabIFrame.getBoundingClientRect(); if(_cldTabFrmRect.right > _bodyWidth){ _cldTabIFrame.style.pixelLeft -= (_cldTabFrmRect.right - _bodyWidth + _nShadowLength); } if(_cldTabFrmRect.bottom > _bodyHeight){ //alert("dd"); _cldTabIFrame.style.pixelTop = _rect.top - _nShadowLength; _cldTabIFrame.style.pixelTop -= (_cldTabFrmRect.bottom - _cldTabFrmRect.top - document.body.scrollTop); } //alert(_cldTabIFrame.style.pixelWidth); _cldTabIFrame = _tmp; //if( } function whenMouseOverCldTabFrm(){ _bCanHide = false; } function whenMouseOutCldTabFrm(){ _bCanHide = true; } function getNextDate(year, month, date){ if(date == null) date = 1; if(date > _monthDays[month + 1]) date = _monthDays[month + 1]; return new Date(year, month + 1, date); } function getLastDate(year, month, date){ if(date == null) date = 1; if(date > _monthDays[month - 1]) date = _monthDays[month - 1]; return new Date(year, month - 1, date); } function switchLastMonth(bLast){ if(bLast == null) bLast = true; var _tmpdate = null; _tmpdate = bLast ? getLastDate(_dCurYear, _dCurMonth, _dCurDate) : getNextDate(_dCurYear, _dCurMonth, _dCurDate); //_curCldTabRltvObj.value = _tmpdate.getFullYear() + "-" + (_tmpdate.getMonth() + 1) + "-" + _tmpdate.getDate(); setTargetFormaValue(_tmpdate.getFullYear(), _tmpdate.getMonth() + 1, _tmpdate.getDate()); _bHaveUpdated = false; //JSCalendar(_curCldTabRltvObj); fillCldTabFrm(_tmpdate.getFullYear(), _tmpdate.getMonth(), _tmpdate.getDate());; } function switchNextMonth(){ switchLastMonth(false); } function switchLastYear(){ //_curCldTabRltvObj.value = (_dCurYear * 1 + 1) + "-" + (_dCurMonth + 1) + "-" + _dCurDate; setTargetFormaValue(_dCurYear * 1 + 1, _dCurMonth * 1 + 1, _dCurDate); _bHaveUpdated = false; //JSCalendar(_curCldTabRltvObj); fillCldTabFrm(_dCurYear * 1 + 1, _dCurMonth * 1, _dCurDate); } function switchNextYear(){ //_curCldTabRltvObj.value = (_dCurYear - 1) + "-" + (_dCurMonth + 1) + "-" + _dCurDate; setTargetFormaValue(_dCurYear * 1 - 1, _dCurMonth * 1 + 1, _dCurDate); _bHaveUpdated = false; //JSCalendar(_curCldTabRltvObj); fillCldTabFrm(_dCurYear * 1 - 1, _dCurMonth * 1, _dCurDate); } function whenMouseOverDateItem(){ var e = _cldTabIFrame.event.srcElement; var _tmpdate = null; if(e.tagName == "TD"){ if(e.name == "LASTMONTH"){ _tmpdate = getLastDate(_dCurYear, _dCurMonth); e.title = "Last : " + _tmpdate.getFullYear() + "-" + (_tmpdate.getMonth() + 1) + "-" + e.innerText; return; } if(e.name == "NEXTMONTH"){ _tmpdate = getNextDate(_dCurYear, _dCurMonth); e.title = "Next : " + _tmpdate.getFullYear() + "-" + (_tmpdate.getMonth() + 1) + "-" + e.innerText; return; } var sCurDate = _dCurYear + "-" + (_dCurMonth + 1) + "-" + e.innerText; e.title = "当前日期 : " + sCurDate; e.style.backgroundColor = "#EFEFEF"; /*去除onmouseover事件对text的负值 王勇*/ //setTargetFormaValue(_dCurYear, _dCurMonth + 1, e.innerText); } } function resetTargetValue(){ //_curCldTabRltvObj.value = ; _bHaveSelectNewValue = true; hideCldTabFrm(); } function setTargetFormaValue(year, month, date){ var _year, _month, _date; _year = year; _month = month * 1; _date = date * 1; if(_month < 10) _month = "0" + _month; if(_date < 10) _date = "0" + _date; _curCldTabRltvObj.value = _year + "-" + _month + "-" + _date; } function whenMouseOutDateItem(){ var e = _cldTabIFrame.event.srcElement; if(e.tagName == "TD") e.style.backgroundColor = ""; } function whenClickDateItem(){ var e = _cldTabIFrame.event.srcElement; var _tmpdate = null; var _month = null; var _date = null; if(e.tagName == "TD"){ _bHaveUpdated = false; if(e.name == "LASTMONTH"){ _tmpdate = getLastDate(_dCurYear, _dCurMonth); setTargetFormaValue(_tmpdate.getFullYear(), _tmpdate.getMonth() + 1, e.innerText); fillCldTabFrm(_tmpdate.getFullYear(), _tmpdate.getMonth(), e.innerText); /* new */ //JSCalendar(_curCldTabRltvObj); return; } if(e.name == "NEXTMONTH"){ _tmpdate = getNextDate(_dCurYear, _dCurMonth); setTargetFormaValue(_tmpdate.getFullYear(), _tmpdate.getMonth() + 1, e.innerText); /* new */ //JSCalendar(_curCldTabRltvObj); fillCldTabFrm(_tmpdate.getFullYear(), _tmpdate.getMonth(), e.innerText); return; } /*对text的负值加入到onclick事件中 王勇*/ setTargetFormaValue(_dCurYear, _dCurMonth + 1, e.innerText); _bHaveSelectNewValue = true; hideCldTabFrm(); } } function hideCldTabFrm(){ //try{ if(!_bHaveSelectNewValue) if(_cldTabIFrame == null || !_bCanHide) return; //alert(_cldTabIFrame); var oFiredObj = null; try{ oFiredObj = event.srcElement; }catch(e){ oFiredObj = _cldTabIFrame.event.srcElement; } if(oFiredObj == _curCldTabRltvObj) return; //alert(_curCldTabRltvObj);// _cldTabIFrame2.style.display = "none"; _bHaveUpdated = false; _bHaveShown = false; removeShadowDiv(); //alert(_bHaveSelectNewValue); if(!_bHaveSelectNewValue) _curCldTabRltvObj.value = _curCldTabRltvObjValue; //}catch(e){_debug(e.description);} } function removeShadowDiv(){ try{ var arrShadowDiv = eval("window.document.arr" + _cldTabFrm.id); for(var i = 0; i < arrShadowDiv.length; i++) arrShadowDiv[i].removeNode(true); }catch(e){_debug(e.description);} } function getValidateDate(sDate){ if(sDate == null) return new Date(); if(sDate.indexOf("-") == -1){ if(isNaN(sDate)) return new Date(); if(sDate * 1 > 9999 || sDate * 1 < 1000) return new Date(); return new Date(sDate, 0, 1); } var tmp = sDate.split("-"); if(isNaN(tmp[0]) || isNaN(tmp[1]) || isNaN(tmp[2]) || tmp[0] > 9999 || tmp[0] < 1000 || tmp[1] > 12 || tmp[1] < 1 || tmp[2] > 31 || tmp[2] < 1) return new Date(); return new Date(tmp[0], tmp[1] - 1, tmp[2]); } //var tst = getValidateDate("2000-7-310"); //alert(tst.getFullYear() + "-" + (tst.getMonth() + 1) + "-" + tst.getDate()); function createDateBox(sBoxName, sDfltValue){ var _d = getValidateDate(sDfltValue); var _month = _d.getMonth() + 1; var _date = _d.getDate(); if(_month * 1 < 10) _month = "0" + _month; if(_date * 1 < 10) _date = "0" + _date; sDfltValue = _d.getFullYear() + "-" + _month + "-" + _date; var _str = "<INPUT READONLY STYLE='border:1px solid gray;text-align:center;cursor:default;' NAME='" + sBoxName + "' VALUE='" + sDfltValue + "' ONCLICK=JSCalendar(this)>"; document.write(_str); } function MakeDivShadowEffect(divObj, color, nLength) { //alert(divObj); var tmpstr = "window.document.arr" + divObj.id + " = new Array();"; eval(tmpstr); //alert( tmpstr ); var arrShadowDiv = eval("window.document.arr" + divObj.id); //window.document.arrJACKSHANGJIELOVEFEIFEI = new Array(); //var arrShadowDiv = window.document.arrJACKSHANGJIELOVEFEIFEI; //alert(arrShadowDiv.length); var _rect = divObj.getBoundingClientRect(); for( i = nLength; i > 0; i --) { var rect = _cldTabIFrame.document.createElement( "DIV" ); rect.style.position = "absolute"; rect.style.left = (divObj.style.posLeft + i ) + "px"; rect.style.top = (divObj.style.posTop + i ) + "px"; rect.style.width = divObj.offsetWidth + "px"; rect.style.height = divObj.offsetHeight + "px"; rect.style.backgroundColor = color; var opacity = 1 - i / (i + 1); //alert(rect.style.width); rect.style.filter = 'alpha(opacity=' + (100 * opacity) + ')'; rect.style.zIndex = divObj.style.zIndex - 1; //alert(divObj.tagName); //divObj.insertAdjacentElement("beforeEnd", rect); _cldTabIFrame.document.body.insertBefore(rect); arrShadowDiv[arrShadowDiv.length] = rect; //alert( i ); } } function _debug(s){ return; //var o = new Option(s, s); //_debugLst.add(o); form1._debugLst.options[form1._debugLst.length] = new Option(s, s, 0, 0); form1._debugLst.options[form1._debugLst.length - 1].selected = true; //_debugLst.item(_debugLst.length - 1).selected = true; } document.onclick = hideCldTabFrm; //createCldTabFrm(); //-->
client_validate.js
//是否为空校验 function isEmpty(s) { var lll=trim(s); if( lll == null || lll.length == 0 ) return true; else return false; } //删除字符串左边的空格 function ltrim(str) { if(str.length==0) return(str); else { var idx=0; while(str.charAt(idx).search(/\s/)==0) idx++; return(str.substr(idx)); } } //删除字符串右边的空格 function rtrim(str) { if(str.length==0) return(str); else { var idx=str.length-1; while(str.charAt(idx).search(/\s/)==0) idx--; return(str.substring(0,idx+1)); } } //删除字符串左右两边的空格 function trim(str) { return(rtrim(ltrim(str))); } /*日期相比较*/ function compareDate(date1, date2) { if (trim(date1) == trim(date2)) return 0; if (trim(date1) > trim(date2)) return 1; if (trim(date1) < trim(date2)) return -1; } //校验是否是Email function isEmail(eml) { if(trim(eml)!='') { var re=new RegExp("@[\\w]+(\\.[\\w]+)+$"); return(re.test(eml)); } else return(true); } //是否是电话号 function isTel(tel) { var charcode; for (var i=0; i<tel.length; i++) { charcode = tel.charCodeAt(i); if (charcode < 48 && charcode != 45 || charcode > 57) return false; } return true; } //校验是否是实数 function isNumber(num) { var re=new RegExp("^-?[\\d]*\\.?[\\d]*$"); if(re.test(num)) return(!isNaN(parseFloat(num))); else return(false); } //校验是否是整数 function isInteger(num) { var re=new RegExp("^-?[\\d]*$"); if(re.test(num)) return(!isNaN(parseInt(num))); else return(false); }
发表评论
-
src\com\bjsxt\drp\business\util
2008-12-29 17:32 1146AppException.java package com. ... -
ssh_training_itemmgr 04
2008-12-29 17:28 752DataDict.java package com.bjs ... -
ssh_training_itemmgr 03
2008-12-29 17:21 950DrpExceptionHandler.java packa ... -
ssh_training_itemmgr 02
2008-12-29 17:11 1026MessageResources.properties 引 ... -
ssh_training_itemmgr 01
2008-12-29 16:58 776applicationContext-actions.xml ... -
采用声明式事务
2008-12-29 15:08 779采用声明式事务 1、声明式事务配置 * 配置Session ... -
采用编程式事务
2008-12-29 13:27 981采用编程式事务 1、getCurrentSession()与 ... -
spring+struts的集成(第二种集成方案)
2008-12-29 12:40 771spring+struts的集成(第二种集成方案) 原理:将业 ... -
spring+struts的集成(第一种集成方案)
2008-12-29 12:26 752spring+struts的集成(第一种集成方案) 原理:在A ... -
spring_dynamic_proxy
2008-12-29 00:38 742SecurityHandler.java package c ... -
AOP4
2008-12-29 00:24 695spring对AOP的支持 1、如果目标对象实现了接口,默认 ... -
AOP3
2008-12-29 00:17 704spring对AOP的支持 Aspect默认情况下不用实现 ... -
AOP2
2008-12-29 00:11 927spring对AOP的只是(采用配置文件的方式) 1、sp ... -
AOP1
2008-12-29 00:08 699spring对AOP的只是(采用Annotation的方式) ... -
spring_static_proxy
2008-12-29 00:01 760UserManager.java package com.b ... -
根据类型自动装配
2008-12-28 23:55 711引用<?xml version="1.0&qu ... -
根据名称自动装配
2008-12-28 23:53 741applicationContext-beans.xml 引 ... -
spring_scope
2008-12-28 23:42 1018spring Bean的作用域: scope可以取值: ... -
spring_injection
2008-12-28 23:14 5561、spring的普通属性注入 参见:spring文档3. ... -
DYNAMIC PROXY
2008-12-24 23:53 797package com.bjsxt.spring; ...
相关推荐
这个"ssh_training_itemmgr.zip"压缩包很可能是提供了一个SSH框架整合的实际项目示例,帮助开发者理解和学习如何在实际应用中运用这些技术。 **Struts** 是一个基于MVC设计模式的Java Web框架,主要用于控制应用...
固定资产管理系统SSH_JSP_MySql(源码+数据库sql+lun文+视频齐全)固定资产管理系统SSH_JSP_MySql(源码+数据库sql+lun文+视频齐全)固定资产管理系统SSH_JSP_MySql(源码+数据库sql+lun文+视频齐全)固定资产管理系统SSH_...
SSH_Test.rar_C ssh_C#ssh_C++ ssh_C++ SSH_libssh2库是一个针对C、C#和C++编程语言的SSH实现示例,特别提到了libssh2库的使用。在Visual Studio 2010环境下,这个压缩包提供了通过SSH进行文件上传的功能。接下来,...
ssh_do all_list执行命令,需要修改脚本“node_list”和集群操作命令即可,执行样例如下:ssh ssh_do_all_list.sh "cat /etc/hosts
本教程将详细介绍如何在QT项目中使用SSH,特别是通过`ssh_qt`库来实现这一功能。 首先,我们需要了解`ssh_qt`库。这是一个基于libssh库的QT模块,提供了在QT应用中方便地调用SSH协议的功能。安装`ssh_qt`库通常涉及...
标题中的"ssh_test.rar_ssh_ssh_test"可能是指一个与SSH(Secure Shell)相关的项目或教程,其中包含了"ssh_test"的实例代码。SSH是一种网络协议,用于安全地远程登录到服务器,执行命令和传输数据。它在IT行业中...
这个名为"SSH.rar_SSH JSP_SSH MyEclipse_ssh_struts hibernate_struts spring"的压缩包文件包含了使用SSH框架开发的一个示例项目,可能是一个学习资源或实际应用的基础。下面我们将详细探讨SSH框架以及与之相关的...
本项目“jsp-ssh.zip”聚焦于使用SSH框架实现的一个JSP(JavaServer Pages)网络在线问答系统。** **1. Struts2:** Struts2是MVC(Model-View-Controller)设计模式的实现,它是Apache软件基金会的一个项目。...
标题"SSH.rar_myeclipse ssh_ssh_ssh myeclipse_ssh2_ssh2 Myeclipse"表明这是一个关于SSH配置和MyEclipse集成的资源包,可能包含了SSH框架在MyEclipse中的配置教程,以及SSH2(更安全的SSH版本)的相关资料。...
SSH_province_sql.rar_SSH_province_sql_ajax_dwr_ssh_ssh_ajax这个标题暗示了这是一个与SSH框架(Struts2、Spring、Hibernate)结合DWR(Direct Web Remoting)实现的项目,主要涉及到了省市县三级联动的数据处理,...
在这个“blog.rar”压缩包中,包含了一个使用SSH框架开发的JSP博客项目,它展示了如何将这三个强大的框架整合到一个实际的Web应用中。 **Struts2** 是MVC(模型-视图-控制器)架构的一个实现,它提供了一种组织应用...
ssh_known_hosts, cookbook ssh_known_hosts的开发库 ssh_known_hosts-cookbook Chef向添加主机和密钥的/etc/ssh/ssh_known_hosts 文件公开资源和默认配方,已知主机的public 键的全局文件。使用键类型和ohai数据...
javaEE_SSH_MVC_MySql动漫论坛的设计与实现(源码+数据库sql+lun文+视频齐全)javaEE_SSH_MVC_MySql动漫论坛的设计与实现(源码+数据库sql+lun文+视频齐全)javaEE_SSH_MVC_MySql动漫论坛的设计与实现(源码+数据库sql+...
4.7javaEE_SSH_MySqL基于SSH的医院在线挂号(源码+数据库sql+lun文+视频齐全);javaEE_SSH_MySqL基于SSH的医院在线挂号(源码+数据库sql+lun文+视频齐全);javaEE_SSH_MySqL基于SSH的医院在线挂号(源码+数据库sql+lun...
标题中的"ssh.rar_java ssh_ssh_ssh 源码"可能指的是包含Java实现SSH功能的源代码压缩包。这个压缩包可能是为了帮助开发者理解和学习如何在Java项目中集成SSH功能,或者是提供一个可复用的SSH客户端或服务器端的代码...
这个名为"ssh_2.rar"的压缩包文件包含了一个基于SSH的项目源码,适合在MyEclipse集成开发环境中运行和学习。 **Struts** 是一个用于构建MVC(Model-View-Controller)架构的Java Web应用程序框架。它提供了处理HTTP...
javaEE_SSH_oracle土地档案管理系统(源码+数据库sql+lun文+视频齐全)javaEE_SSH_oracle土地档案管理系统(源码+数据库sql+lun文+视频齐全)javaEE_SSH_oracle土地档案管理系统(源码+数据库sql+lun文+视频齐全)javaEE_...
"淘宝发货__ssh__网上商城(ssh_eshop)__sqlserver.zip" 这个标题表明我们正在处理一个与网上商城系统相关的压缩文件。"ssh"通常指的是Struts2、Spring和Hibernate这三个Java开发框架的组合,它们在Web应用开发中广泛...
JuiceSSH_2.1.4.apk