<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>登录</title>
<link href="css/bootstrap.min.css" rel="stylesheet"></head><body><nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="./">jsp作业</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li><a href="login.html">登录</a></li>
</ul>
</div>
</div></nav><div class="container">
<div class="row">
<div class="col-md-4">
</div>
<div class="col-md-4">
<form class="form-signin" target="submitFrame" method="post">
<h2 class="form-signin-heading">登录到jsp作业</h2>
<label for="inputEmail">Email</label>
<input type="email" id="inputEmail" class="form-control" placeholder="请输入Email" required autofocus><br>
<label for="inputPassword">密码</label>
<input type="password" id="inputPassword" class="form-control" placeholder="请输入密码" required>
<div class="checkbox">
<label>
<input type="checkbox" value="remember-me" checked="checked">记住密码</label>
</div>
<button type="submit" class="btn btn-primary" id="btn-login">登录</button>
<a href="reg.html" class="btn btn-default">注册</a>
</form>
<iframe style="display: none" name="submitFrame" src="about:blank"></iframe>
</div>
<div class="col-md-4">
</div>
</div>
<script src="js/jquery.min.js"></script></body></html>
用PHP。登录页面:
<html>
<head><title>Login</title></head>
<body>
<form action="login_page.php" method="GET">
<label for="name">Name: </label><input type="text" name="name" />
<label for="passwd">Password: </label><input type="password" name="passwd" />
<button type="submit>Login</button>
</form>
</body>
</html>
登录后页面:
<?php
if(isset($_GET['name'], $_GET['passwd'])) {
if($_GET['name'] == '你设的用户名' &&$_GET['passwd'] == '你设的密码') {
print "登录成功!在此加入自定义输出"
}
}
?>
用ASP也类似。
这个只能通过框架才能实现,iframe或者ajax都可以实现,也就是说通过框架实现单点登录,个人建议最好用ajax,效率高速度快,而且不收运行环境影响,否则光靠html是不可能完成的,毕竟他是静态页面!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)