대화 상자 dialog 로그인 후 Jquery 는 페이지가 일정한 시간에 이동합니다

<%@ page language="java" import="java.util.*"  contentType="text/html;charset=UTF-8" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML>
<html>
  <head>
  	<!-- jquery   1111-->
	<script  src="<%=path%>/js/jquery-1.7.2.min.js"></script>
	<!-- jquery     -->
	<script  src="<%=path%>/js/jquery.flexigrid.js"></script>
	<!-- jquery   -->
	<script  src="<%=path%>/js/jquery.draggable.js"></script>
	<!-- jquery     -->
	<script  src="<%=path%>/js/jquery.resizable.js"></script>
	<!-- jquery   -->
	<script src="<%=path%>/js/jquery.linkbutton.js"></script>
	<!-- jquery   -->
	<script  src="<%=path%>/js/jquery.shadow.js"></script>
	<!-- jquery      -->
	<script  src="<%=path%>/js/jquery.dialog.js"></script>
	<!-- jquery     -->
	<script  src="<%=path%>/js/jquery.contextmenu.js"></script>
	<script  src="<%=path%>/js/jquery.contextmenu.packed.js"></script>
	<!-- jquery      -->
	<script  src="<%=path%>/js/jQuery.FillOptions.js"></script>
	<script  src="<%=path%>/js/jQuery.CascadingSelect.js"></script>
  	<link rel="stylesheet"  href="<%=path%>/css/dialog.css"/>
	<script>
	function open_dialog(){
		$("#register-form").dialog({
		 	hide:true,    //       ,      ,           .
			href:"dialog_login.jsp",
			width:320,
			height:400,
			autoOpen:false,
			modal:true,
			buttons:{
				  :function(){
					var params=$("#reg-form").serialize();
					params = decodeURIComponent(params,true);  
					//alert(params);
					if(addConsumerValidate(params)){
						$.ajax({
							type: "POST",
							url: "consumer_addConsumerOfDialog.action",
							data: encodeURI(params),
							dataType:"text",
							success: function(msg){
								if(msg=="success"){
									$("#register-form").dialog({closed:true});
									alert("      !");
									$("#message").show();
									jump(5);
								}else{
									alert("      ,     !");
									$('#register-form#reg-form').reset();
								}
							},
							error: function(msg){
								alert("msg="+msg);
							}
						});
					}
				},
				  :function(){
	      			//    Dialog
	      			$("#register-form").dialog({closed:true});
	     		}
			}
		});
	}
	function addConsumerValidate(param){
		//alert(param);
		var user = param.split("&");
      	var name =user[0].split("=")[1];
      	var pass =  user[1].split("=")[1];
      	var reg=/^[1-9]\d*$|^0$/; 
   		if(pass == "" || pass == null || reg.test(pass) == false){
	    	window.alert("            ");
	    	return false;
	    }
	    else if(name == "" || name == null)
	    {
			window.alert("      ");
	    	return false;
		}
		return true;
      }
       function jump(count) {       
            window.setTimeout(function(){       
                count--;       
                if(count > 0) {
                	document.getElementById('time').innerHTML=count;       
                    //$('#last').attr('innerHTML', count);//   ,           ,              
                    jump(count);       
                } else {       
                    window.location="<%=basePath%>login.html";      
                }       
            }, 1000);       
        }       
        
   </script>
  </head>
 <body>
	<div id="register-form" title="    ">
	<input type="button" value="     " onclick="open_dialog();" />
	</div>
	<div id="message" style="display:none">
	<span id="time">5</span>          !
	</div>
 </body>
</html>

좋은 웹페이지 즐겨찾기