页面按钮设置

来源:互联网 发布:苹果蜂窝数据dns被劫持 编辑:程序博客网 时间:2024/05/13 08:23


设置三个按钮,分别为:

保存并关闭”:保存新增信息并返回列表页面

保存并添加”:保存新增信息并继续添加

关闭”:退出当前新增信息页面,不保存

JSP页面:

增加按钮

<span style="white-space:pre"></span>     <span style="font-size:18px;">var dg =  frameElement.lhgDG; dg.addBtn('closeBtn','关闭',closeOnClick);  dg.addBtn('saveBtn','保存并关闭',saveOnClick); dg.addBtn('addBtn','保存并添加',addOnClick);</span>


为按钮增加事件

//关闭按钮function closeOnClick(){var proofInfoId = $j("#proofInfoId").val();var ajaxurl ="<%=path%>/pages/business/outside/deleteProofPictureByProofInfoId.action?proofInfo.id="+proofInfoId;$j.ajax({           <span style="white-space:pre"></span>type:"GET",            <span style="white-space:pre"></span>url:ajaxurl,            <span style="white-space:pre"></span>datatype: "text",            <span style="white-space:pre"></span>success:function(data){             <span style="white-space:pre"></span>dg.curWin.unbindunbeforunload();dg.cancel();          }         });         dg.curWin.unbindunbeforunload(); dg.cancel();}function unbindbeforeunload() {dg.curWin.unbindunbeforunload();}//保存并关闭按钮 function saveOnClick(){ dg.curWin.unbindunbeforunload();    if(formcheck.onSubmit(this)){    var arr = new Array();arr[0]=document.getElementById("proofInfoId").value; //物证ID;arr[1]=document.getElementById("proofName").value; //物证名称(代码)arr[2]=arr[1];//arr[2]=getSelValue(document.getElementById("proofName")); //物证名称(中文)arr[3]=document.getElementById("proofCategory").value; //物证类别(代码)arr[4]=getSelValue(document.getElementById("proofCategory")); //物证类别(中文)arr[5]=document.getElementById("proofType").value; //物证类型(代码)arr[6]=getSelValue(document.getElementById("proofType")); //物证类型(中文)arr[7]=document.getElementById("extractMode").value;  //提取方法arr[8]=document.getElementById("extractPart").value; //提取部位arr[9]=document.getElementById("saveTimeLimit").value; //保存时限(代码)arr[10]=getSelValue(document.getElementById("saveTimeLimit")); //保存时限(中文)arr[11]=document.getElementById("geometryCharacteristic").value;  //几何特性(代码)arr[12]=getSelValue(document.getElementById("geometryCharacteristic")); //几何特性(中文)arr[13]=document.getElementById("proofSize").value;  //尺寸arr[14] = arr[13].replace(/^0*/g, "");arr[15]=document.getElementById("mainFeature").value;  //主要特征arr[16]=document.getElementById("statusDes").value;  //状态描述arr[18]=document.getElementById("reserve4").value;  //物证大小 17是现勘过来的图片dg.curWin.addProofTable(arr);dg.cancel();    } }  // 保存并添加按钮function addOnClick(){dg.curWin.unbindunbeforunload();    if(formcheck.onSubmit(this)){    var arr = new Array();arr[0]=document.getElementById("proofInfoId").value; //物证ID;arr[1]=document.getElementById("proofName").value; //物证名称(代码)arr[2]=arr[1];//arr[2]=getSelValue(document.getElementById("proofName")); //物证名称(中文)arr[3]=document.getElementById("proofCategory").value; //物证类别(代码)arr[4]=getSelValue(document.getElementById("proofCategory")); //物证类别(中文)arr[5]=document.getElementById("proofType").value; //物证类型(代码)arr[6]=getSelValue(document.getElementById("proofType")); //物证类型(中文)arr[7]=document.getElementById("extractMode").value;  //提取方法arr[8]=document.getElementById("extractPart").value; //提取部位arr[9]=document.getElementById("saveTimeLimit").value; //保存时限(代码)arr[10]=getSelValue(document.getElementById("saveTimeLimit")); //保存时限(中文)arr[11]=document.getElementById("geometryCharacteristic").value;  //几何特性(代码)arr[12]=getSelValue(document.getElementById("geometryCharacteristic")); //几何特性(中文)arr[13]=document.getElementById("proofSize").value;  //尺寸arr[14] = arr[13].replace(/^0*/g, "");arr[15]=document.getElementById("mainFeature").value;  //主要特征arr[16]=document.getElementById("statusDes").value;  //状态描述arr[18]=document.getElementById("reserve4").value;  //物证大小 17是现勘过来的图片dg.curWin.addProofTable(arr);location.reload();    }}

表格代码

<table class="form_table" width="100%" border="0" cellspacing="1" cellpadding="0"><tr class="head"><td colspan="4"> <img src="<%=path%>/images/title.gif" align="absmiddle" hspace="5">物证信息 <!-- <div style="float:right"><input id="saveBtn" type="button" value="保 存" class="button-55" onclick="addOnClick()";> <input id="cancelBtn" type="button" value="返 回" class="button-55" onclick="backOnClick()";> </div> --></td></tr><tr class="list"><td class="label" rowspan="3"><div style="padding:4px;"><img src="<%=path%>/images/must.gif"/>物证类别:</div><div style="padding:4px;"><img src="<%=path%>/images/must.gif"/>物证类型:</div><div style="padding:4px;"><img src="<%=path%>/images/must.gif"/>物证名称:</div></td><td class="content" rowspan="3"><jdf:thirdSelect name="pi.proofCategory" id="proofCategory" dictName="WZLBDM" listKey="key" listValue="value" cssClass="validate['required']" secondSelectName="pi.proofType" secondSelectLabel="" secondSelectId="proofType" secondSelectCssClass="validate['required']" ></jdf:thirdSelect><ww:textfield id="proofName" name="pi.proofName" cssStyle="width:80%" cssClass="validate['length[0,25]','required']"/></td><td class="label"><img src="<%=path%>/images/must.gif"/>保存时限:</td><td class="content"><jdf:commonDict dictName="BCQXDM" listKey="key" listValue="value" name="pi.saveTimeLimit" id="saveTimeLimit" emptyOption="true" cssStyle="width:80%" cssClass="validate['required']"></jdf:commonDict></td></tr><tr class="list"><td class="label">物证大小:</td><td class="content"><ww:textfield name="pi.proofSize" id="proofSize" cssStyle="width:80%;" cssClass="validate['length[0,100]']" /></td></tr><tr class="list"><td class="label">几何特性:</td><td class="content"><jdf:commonDict dictName="JHTXDM" listKey="key" listValue="value" name="pi.geometryCharacteristic" id="geometryCharacteristic"  cssStyle="display:inline;width:80%"></jdf:commonDict></td></tr> <tr class="list"> <td class="label">物证数量:</td><td class="content" ><ww:textfield name="pi.reserve4" id="reserve4"  cssClass="validate['length[0,32]']" cssStyle="width:80%;"/></td><td class="label">物证图片:</td><td class="content" ><img src="<%=path %>/images/attach.gif" onclick="addPicPath('${proofInfo.id }');" style="cursor:hand;" alt="上传照片" align="absmiddle">  <a href="#" onclick="takePhoto('${proofInfo.id}');"><img alt="拍照" src="<%=path %>/images/\icon\16x16\camera.jpg" border="0"/></a></td></tr> <tr class="list"><td class="label">提取方法:</td><td class="content"> <ww:textfield name="pi.extractMode" id="extractMode" cssStyle="width:80%" cssClass="validate['length[0,100]']"/></td><td class="label">提取部位:</td><td class="content"><ww:textfield name="pib.extractPart" id="extractPart" cssStyle="width:80%" cssClass="validate['length[0,100]']"/></td></tr><tr class="list"><td class="label">主要特征:</td><td class="content" colspan="3"><textarea rows="8" style="width:90%" name="pi.mainFeature" id="mainFeature" class="validate['length[0,1000]']"></textarea></td></tr><tr class="list"><td class="label">状态描述:</td><td class="content" colspan="3"><textarea rows="8" style="width:90%" name="pib.statusDes" id="statusDes" class="validate['length[0,1000]']"></textarea></td></tr> <tr class="list"><td class="label" height="80" width="20%">物证照片:</td><td class="content" colspan="3" width="80%"><div id="imgarea" style="margin-top:5px;margin-bottom:5px;width:95%;"></div></td></tr> </table>

实现效果:



0 0
原创粉丝点击