跳跃错误时保持打开弹出窗口

时间:2016-04-20 08:08:13

标签: javascript php jquery twitter-bootstrap bootstrap-modal

情况是我有一个bootstrap模式,我有一个表单登录,如果用户不活动或密码不正确,跳错了,但当你点击登录如果你得到这个错误窗口不是打开以显示它,因此用户不知道传递。

我想知道如何在跳过错误时打开模式显示它。

nav ul{
	list-style:none;
	margin:2em 0;
}

nav li{
	margin-right:2em;
	display:inline-block;
}

.modal-body, .modal-header{
	background:#2c3338;
	color:#606468;
}

#signin{
	width:auto;
	height:auto;
}

#signin span{
	background-color:#363b41;
	border-radius:3px 0px 0px 3px;
	-moz-border-radius:3px 0px 0px 3px;
	-webkit-border-radius:3px 0px 0px 3px;
	color:#606468;
	display:block;
	float:left;
	height:50px;
	line-height:50px;
	text-align:center;
	width:50px;
}

#signin input{
	height:50px;
}

#signin input{
	background-color:#3b4148;
	border-radius:0px 3px 3px 0px;
	-moz-border-radius:0px 3px 3px 0px;
	-webkit-border-radius:0px 3px 3px 0px;
	color:#606468;
	margin:0 0 2% 5%;
	padding:0 16px;
	width:198px;
}

#signin input:focus{
	border:2px solid #785da1;
	outline:none;
    box-shadow:0 0 10px #785da1;
}

#signin input[type="submit"]{
	width:280px;
	height:55px;
	border-radius:3px;
	-moz-border-radius:3px;
	-webkit-border-radius:3px;
	background-color:#624291;
	color:#eee;
	font-weight:bold;
	margin:2% 0 2% 2%;
}

#signin input[type="submit"]:hover{
	background-color:#7842A6;
}

#signin a{
	color:#eee;
	text-decoration:none;
}

#signin a:hover{
	text-decoration:underline;
}

#signin p{
	width:300px;
	height:auto;
}

#signin input{
	border:none;
	font-family:'Calibri';
	font-size:14px;
	line-height:1.5em;
	padding:0;
	-webkit-appearance:none;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" lang="es-es">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<link href="css/bootstrap.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="font-awesome-4.5.0/css/font-awesome.min.css"/>
		<link href="css/css.css" rel="stylesheet" type="text/css" media="all" />
		<link rel="stylesheet" type="text/css" href="css/icSquared_v1.0.css"/>
		<title>SSSS!</title>
	</head>
<body>
<?php
	include 'fn.php';
	iniciarSesion();

	$msg = "";
	if(isset($_GET['miss']))
    {
        if($_GET['miss']=="1")
        {
           $msg= '<p class="text-danger text-center small" style="margin-bottom: 0;"> No existe este usuario con esta contraseña.. </p>';
        }
		elseif($_GET['miss']=="2")
        {
           $msg= '<p class="text-danger text-center small" style="margin-bottom: 0;"> Este usuario esta inactivo. </p>';
        }
    }
?>
<div>
	<header>
        <nav role="navigation" class="noround navbar-inverse">
            <div class="navbar-header">
				<button type="button" data-target="#navbarCollapse" data-toggle="collapse" class="navbar-toggle">
					<span class="sr-only"> Barra de navegación</span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
				</button>
			</div>
					
			<div class="collapse navbar-collapse" id="navbarCollapse">
                <ul class="nav navbar-nav navbar-left" style="margin:10px 0 10px 0">
                    <a href="index.php"><img src="fotos/logoH.png" /></a>
                </ul>
                <ul class="nav navbar-nav navbar-right">
                    <li><a href="registro.php"> Registrate <span class="fa fa-user-plus" style="font-size:16px; margin-top:5px"></span></a></li>
                    <li><a href="#modalLogin" data-target="#modalLogin" data-toggle="modal"> Identificate <span class="fa fa-user" style="font-size:16px; margin-top:5px"></span><span class="caret"></span></a></li>
                </ul>
			</div>
        </nav>
	</header>
  
  </div>

<div class="modal fade" id="modalLogin" role="dialog" aria-hidden="true">
	<div class="modal-dialog modal-lg">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal"><i class="fa fa-times white"></i></button>
			</div>
			<div class="modal-body text-center">
				<?php echo $msg; ?>
				<form action="action.php?action=login" method="post" class="form" id="signin">
					 <div class="form-group">
						<p style="margin-left:4%"><span class="fa fa-user"></span>
						<input type="text" placeholder="ejemplo@ejemplo.com" name="emailLog" required class="form-control" style="padding-left:16px;" /></p>
					 </div>
					 <div class="form-group">
						<p style="margin-left:4%"><span class="fa fa-lock"></span>
						<input type="password" placeholder="contraseña" name="passwd" required class="form-control" style="padding-left:16px;" /></p>
					 </div>
					 <div class="form-group">
						<p class="text-center"><a href="">Has olvidado la contraseña?</a></p>
						<p style="height:70px;"><input type="submit" class="btn" id="enviar" value="ENTRAR" /></p>
					 </div>
				</form>
				<p>No eres miembro?<a href=""> Registrate Ahora </a><span class="fa fa-arrow-right"></span></p>
			</div>
		</div>
	</div>
</div>

<script src="js/jquery-1.12.1.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>

我不需要把我的“action.php”,我知道php和我说得对,当我处理表单时,如果URL通过GET花费了错误,我需要知道如何打开窗口以显示错误

非常感谢所有人:)

0 个答案:

没有答案