zoukankan      html  css  js  c++  java
  • js对话框5秒自动消失

    使用了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="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>
    
  • 相关阅读:
    python写入excel数据xlwt模块
    windows系统共享目录的设置
    mysql索引的建立和查询语句优化
    mysql事务的使用
    mysql读写分离-mysql-proxy的配置
    mysql主从复制配置
    linux下mysql5.7的安装配置
    Python 的介绍与发展史、解释器类型、环境安装、执行代码。
    Python 的课程介绍
    python_django_在views模块中操作状态保持(session)
  • 原文地址:https://www.cnblogs.com/upcyaya/p/5507831.html
Copyright © 2011-2022 走看看