JSP/SERVLET(7)——JSP页面弹出框

1、页面部分:

<div id="dateWin" style="display:none;position:absolute;width:300px;height:160px;margin-top: 200px;background-color:white;border:#9999cc 1px groove">
<form id="dateForm" name="dateForm">
<table style="padding-left:0px;width:300px;">
<tr><td colspan="2">
<div style="height:25px;width:100%;background-color:#D7E1F6;padding-top:7px;padding-left:2px;"> 请输入归档日期</div>
</td></tr>
<tr>
<td style="width: 85px;">  归档状态</td>
<td>
<input type="text" name="FileTypeComm" readonly="readonly" />
<input type="text" name="FileTypeNameComm" readonly="readonly" />
</td>
</tr>
<tr>
<td>  归档日期</td>
<td>
<input name="FileDate" />
</td>
</tr>
<tr><td colspan="2">  <span style="float:right;"><input type="button" value="确定 " onclick="generateArchive();"/>
<input type="button" value="取消 " onclick="document.getElementById('dateWin').style.display='none';"/> </span></td></tr>
</table>
</form>
</div>
<div>
<table>
<tr>
<th>归档状态</th>
<td>
<input type="button" value=" 部门归档 " onClick="openDateWin('1','部门归档');"/>
<input type="button" value=" 公司归档 " onClick="openDateWin('2','公司归档');"/>
</td>
</tr>
</table>
</div>

 

2、js部分:

function rePositionDateWin(){
var elmt=document.getElementById('dateWin');
var left=(document.body.clientWidth-elmt.style.left.replace('px',''))/2;
var top=(document.body.clientHeight-elmt.style.top.replace('px',''))/2;
elmt.style.left=left+'px';
elmt.style.top=top+'px';
}
window.onresize=rePositionDateWin;
function openDateWin(str1,str2){
var elmt=document.getElementById('dateWin');
rePositionDateWin();
elmt.style.display='block';
document.dateForm.FileTypeComm.value=str1;
document.dateForm.FileTypeNameComm.value=str2;
disableE(document.dateForm.FileTypeComm,true);
disableE(document.dateForm.FileTypeNameComm,true);
}
function generateArchive(){
if(confirm("确定吗")){
alert("yes");
}
return false;
}

 

  

posted @ 2015-05-01 23:56  xu_shuyi  阅读(287)  评论(0)    收藏  举报