使用了easyui的对话框控件
<html>
<head>
<title>5秒后关闭对话框</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="easyui/demo.css">
<script type="text/javascript" src="easyui/jquery.min.js"></script>
<script type="text/javascript" src="easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="javascripts/chat.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#dlg').dialog('close');
var mTime = 5;
var time;
$("#openDlg").click(function(){
mTime=5;
document.getElementById("license").innerText=license;
document.getElementById("kind").innerText=kind;
document.getElementById("operator").innerText=operator;
document.getElementById("mTime").innerText=mTime;
$('#dlg').dialog('open');
var interval=setInterval(function(){
var dialog = $("#dlg").parent().is(":hidden");
if (!dialog){
if (mTime>1){
mTime=mTime-1;
document.getElementById("mTime").innerText=mTime;
}
else{
$('#dlg').dialog('close');
clearInterval(interval);
}
}
},1000);
}
});
</script>
</head>
<body>
<a href="javascript:void(0)" class="easyui-linkbutton" id ="openDlg">打开对话框</a>
<div id="dlg" class="easyui-dialog" style="width:400px;height:200px;padding:10px" data-options="buttons: [{text:'确认',iconCls:'icon-ok',handler:function(){alert('ok');}},{text:'取消',handler:function(){alert('cancel');;}}]">
<label id="mTime"></label>秒后自动确认。
</div>
</body>
</html>