1、页面
2、js
<table cellspacing="0" cellpadding="4" width="100%" align="center" border="0" class="table_title">
<tr>
<th width="5%">
选择
</th>
<th width="20%">
文件名
</th>
<th width="20%">
大小
</th>
<th width="30%">
操作
</th>
</tr>
<%
for(int i=0;i<bakfileSize;i++){
DataFile dataFile = (DataFile)bakfileList.get(i);
String fileName = dataFile.getFileName();
long fileSize = dataFile.getFileSize();
%>
<tr id="" onMouseOver="changeColor(this,1)" onmouseout="changeColor(this,2)">
<td>
<input type="radio" name="itemradio" value="<%=fileName%>" />
</td>
<td>
<%=fileName%>
</td>
<td>
<%=fileSize%> KB
</td>
<td>
<a href="delBakFile.jsp?file_name=<%=fileName%>">删除</a>
</td>
</tr>
<%}%>
<tr>
<th colspan="4" align="center">
<input type="button" value="开始还原数据" class="submitButton" onclick="restore()"/>
</th>
</tr>
</table>
2、js
function restore(){//恢复数据库,每次只能恢复一个文件
var itemradio = document.getElementsByName("itemradio");
var itemvalue = '';
for(i=0;i<itemradio.length;i++)
{
if(itemradio[i].checked){
itemvalue = itemradio[i].value;
}
}
if(itemvalue==''){
alert('请选择备份的数据库!');
return false;
}
document.getElementById('backup_dbname').value = itemvalue;
document.submitForm.submit();
}