Ⅰ 用html代码编写一个简单的登陆界面
<!DOCTYPE html><html lang="zh-CN"><head>
<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>
Ⅱ 用html javascript做一个用户注册窗口,要求实现登录名不为空,且两次密码输入一致的功能
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<button onclick="dengRu()">登入</button>
<button onclick="zhuCe()">注册</button>
</body>
</html>
<script type="text/javascript">
var a1;var b1;
var a2;var b2;
var a3;var b3;
var ciShu = 1;
function zhuCe(){
alert("欢迎进入注册界面");
if(ciShu == 1){
a1 = prompt("请注册您的账号");
if(a1==""||==null){
alert("账号不能为空")
}else{
b1 = prompt("请注册您的密码");
if(b1==""||b1==null){
alert("密码不能为空")
}else if(ciShu== 2){
a2 = prompt("请注册您的账号");
if(a2==""||a2==null){
alert("账号不能为空");
}else{
b2 = prompt("请注册您的密码");
if(b2==""||b2==null){
alert("密码不能为空")
}else if(ciShu== 3){
a3 = prompt("请注册您的账号");
if(a3==""||a3==null){
alert("账号不能为空")
}else{
b3 = prompt("请注册您的密码");
if(b3==""||b3==null){
alert("密码不能为空")
}else{
}
console.log("第"+ciShu+"次注册");
console.log("账号1为"+a1+",密码1为"+b1);
console.log("账号2为"+a2+",密码2为"+b2);
console.log("账号3为"+a3+",密码3为"+b3);
ciShu++;
}
}
}
}
}
}
}
function dengRu(){
alert("欢迎进入登入界面");
var zhangHao = prompt("请输入您的账号");
var miMa = prompt("请输入您的密码");
if(zhangHao==a1&&miMa==b1||zhangHao==a2&&miMa==b2||zhangHao==a3&&miMa==b3){
alert("登录成功")
}else{
alert("登录失败")
}
}
</script>
Ⅲ 注册/登陆页面HTML代码该怎么写
以下为个人原创教学例子,任何人引用需注明出自网络知道用户am7972,楼主可供参考
该例子涵盖了文本框、密码框、下拉菜单、单选框、复选框及文本区的使用
同时在数据的使用方面涵盖了文本型、数值型、日期型、布尔型的使用
也涵盖了在会员信息入数据库前,进行严格的数据检查
不足处,JS验证还不是太完善,不过有服务端认证足够了
<title>会员注册</title>
<script type="text/javascript">
<!--function CheckForm()
{
if(document.userinfo.username.value == "")
{ alert("请输入姓名,姓名不能为空!");
document.userinfo.username.focus();
return false;
}
if(document.userinfo.username.value.length > 10)
{
alert("输入的姓名长度最多为10个字符!");
document.userinfo.username.focus();
return false;
}
}
//--></script>
</head>
<body>
<table border="1" width="53%" bordercolorlight="#000000" cellspacing="0" id="table1" height="358" bordercolor="#000000" bordercolordark="#FFFFFF" cellpadding="0">
<form method="POST" action="bb.asp" name="userinfo" onsubmit="return CheckForm();">
<tr><td colspan="2" height="37"> <p align="center">会员注员</td> </tr>
<tr> <td width="37%" align="right">姓名:</td> <td width="61%"> <input type="text" name="username" value="libin" size="13"> </td> </tr>
<tr> <td width="37%" align="right">密码:</td> <td width="61%"> <input type="password" name="userPassword" size="20" value="123"></td> </tr>
<tr> <td width="37%" align="right">性别:</td> <td width="61%"><input type="radio" value="True" checked name="Sex">男 <input type="radio" name="Sex" value="False">女</td> </tr>
<tr> <td width="37%" align="right">生日:</td> <td width="61%"> <input type="text" name="userSR" size="11" value="1985-03-12"></td> </tr>
<tr> <td width="37%" align="right">年龄:</td> <td width="61%"><input type="text" name="userNL" size="9" value="13"></td> </tr>
<tr> <td width="37%" align="right">爱好:</td> <td width="61%"> <input type="checkbox" name="ah" value="sw">上网 <input type="checkbox" name="ah" value="ds" checked>读书 <input type="checkbox" name="ah" value="ty">体育</td> </tr>
<tr> <td width="37%" align="right">上网方式:</td> <td width="61%">
<select size="1" name="swfs"> <option selected value="bhsw">拨号上网</option> <option value="wxsw">无线上网</option> <option value="gxsw">光纤上网</option> </select>
</td> </tr>
<tr> <td width="37%" align="right">个人简介:</td> <td width="61%"><textarea rows="9" name="userGrjs" cols="34"></textarea></td> </tr> <tr> <td colspan="2" height="38"> <p align="center"><input type="submit" value="提交" name="B1"> <input type="reset" value="重置" name="B2"></td>
</tr>
</form>
</table>
====bb.asp的会员注册非法数据监测====
<%
username = Request("username")
userPassword = Request("userPassword")
Sex = Request("Sex")
userSR = Request("userSR")
userNL = Request("userNL")
ah = Request("ah")
swfs = Request("swfs")
userGrjs = Request("userGrjs")
'判断数据合法性,绝对不能让非法数据进入系统
'判断姓名username合不合法,是否包含非法数据
username = Trim(username) '例如:" 张 三 "经过处理之后变成"张 三"
If username ="" Then
Response.write "姓名不能为空"
Response.End
End If
If Len(username)>10 Then
Response.write "姓名字数不能超过10个字" 'Len("Z")=1 Len("国")=2
Response.End
End If
For i = 1 To Len(username)
q = Mid(username,i,1)
If InStr("!@#$%^&*()_-+|<>?/"",.",q)>0 Then
Response.write "姓名不能包含特殊符号!@#$%^&*()_-+|<>?/"",."
Response.End
End If
Next
'判断密码合不合法,是否包含非法数据userPassword = Trim(userPassword)If userPassword ="" Then Response.write "密码不能为空" Response.EndEnd If
If Len(userPassword)>20 Then
Response.write "密码字数不能超过20个字"
Response.End
End If
'判断密码合不合法,是否包含非法数据
Sex = Trim(Sex)
If Sex = "" Then
Response.write "性别不能为空"
Response.End
End If
If Sex <> "True" And Sex <> "False" Then
Response.write "性别不能为不男不女"
Response.End
End If
'判断生日合不合法,是否包含非法数据
userSR = Trim(userSR)
If userSR ="" Then
Response.write "生日不能为空"
Response.End
End If
If Len(userSR)<8 Or Len(userSR)>10 Then '例如:2012-6-3 2012-11-23
Response.write "你输入的生日字数不对,应为2012-6-3或2012-11-23格式"
Response.End
End If
If IsDate(userSR)=False Then
Response.write "你输入的生日格式不能转化为日期,请核实"
Response.End
End If
If DateDiff("yyyy",userSR,Date())<1 Or DateDiff("yyyy",userSR,Date())>200 Then
Response.write "根据你输入的生日你可能小于1岁或已经超过200岁了,请核查重新输入"
Response.End
End If
'判断年龄合不合法,是否包含非法数据userNL = Trim(userNL)If userNL ="" Then
Response.write "年龄不能为空"
Response.End
End If
If IsNumeric(userNL)=False Then
Response.write "你输入的年龄不能转化为数值,请核查"
Response.End
End If
userNL = CInt(userNL)
If userNL<0 Or userNL>200 Then
Response.write "你输入的年龄不能小于0岁或者大于200岁,请核查"
Response.End
End If
'判断爱好合不合法,是否包含非法数据ah = Trim(ah) '选择多个爱好则系统会用,分开 //测试
ah = Replace(ah," ","")
arrAh = Split(ah,",")
For i = LBound(arrAh) To UBound(arrAh)
If arrAh(i)<>"sw" And arrAh(i)<>"ds" And arrAh(i)<>"ty" Then
Response.write i & "你选择的爱好有问题,请核查" & arrAh(i)
Response.End
End If
Next
'判断上网方式合不合法,是否包含非法数据swfs = Trim(swfs)If swfs = "" Then
Response.write "上网方式不能为空"
Response.End
End If
If swfs<>"bhsw" And swfs<>"wxsw" And swfs<>"gxsw" Then
Response.write "你选择的上网方式有问题,请核查"
Response.End
End If
'判断个人简介是否为空,是否超出1000个字
userGrjs = Trim(userGrjs)
If userGrjs = "" Then
Response.write "个人简介不能为空"
Response.End
End If
If Len(userGrjs) > 1000 Then
Response.write "个人简介不能超过1000个字"
Response.End
End If
Response.write "数据合法性检测通过"
%>
====登陆的HTML代码可相信楼主参照会员注册代码应该没问题了====
Ⅳ 求html登陆界面详细代码。要可以登陆,用数据库保存。
这是我曾经写过的一个登录页面的详细代码,供你参考,asp的代码,不知道你看得懂不?
文件名是:deafaule.asp
<% @ Language=VBScript %>
<!--#include file="inc/jf.asp"-->
<html>
<head>
<title>欢迎使用
<%
Response.Write (JFrs("Company_Name") & " —— " & JFrs("Software_Name"))
Response.Cookies("Visiter")("Identification") = "ChunLeiSky" '设置cookies的标识,在后面检测浏览器是否支持cookies
Response.Cookies("Visiter").Expires = dateadd("n",10,now()) '设置cookies的有效期为10分钟
Dim an
Randomize
an= int((99999-11111+1) * RND +11111)
session("FrontPage_Yzm")=an
%>
</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="Content-Language" content="zh-cn" />
<link rel="stylesheet" type="text/css" href="main.css">
<script language=VBScript src=load.js></script>
<script language="JavaScript">
function FrontPage_valid() {
if (document.FrontPage_Form.loginName.value == "") {
alert("请先输入 [用户名] !\n如果没有帐号请先 注册!");
document.FrontPage_Form.loginName.focus();
return false;
}
else if (document.FrontPage_Form.loginName.value.length < 2) {
alert("在 [用户名] 中,请至少输入 2 个字符!");
document.FrontPage_Form.loginName.focus();
return false;
}
else if (document.FrontPage_Form.loginPassword.value == "") {
alert("请输入[密码]!");
document.FrontPage_Form.loginPassword.focus();
return false;
}
else if (document.FrontPage_Form.loginPassword.value.length < 5) {
alert("在 [密码] 中,请至少输入 5 个字符!");
document.FrontPage_Form.loginPassword.focus();
return false;
}
else if (document.FrontPage_Form.FrontPage_Yzm.value == "") {
alert("请输入[验证码]!");
document.FrontPage_Form.FrontPage_Yzm.focus();
return false;
}
else if (document.FrontPage_Form.FrontPage_Yzm.value.length != 5) {
alert("在 [验证码] 中,请输入 5 位数字!");
document.FrontPage_Form.FrontPage_Yzm.focus();
return false;
}
else if (document.FrontPage_Form.FrontPage_Yzm.value.length == 5) {
var i=0,ch;
for (i=0;i<5;i++) {
ch=document.FrontPage_Form.FrontPage_Yzm.value.charAt(i);
if (ch<"0" || ch>"9") {
alert("在 [验证码] 中,必须输入 5 位数字!");
document.FrontPage_Form.FrontPage_Yzm.focus();
return false;
break;
}
}
}
else {
return true;
}
}
function setfocus() {
document.FrontPage_Form.loginPassword.focus();
return;
}
</script>
</head>
<script language="JavaScript">
if (screen.width == 1440) {
document.write("<body background='images/bg750.jpg' onload='JavaScript:setfocus();'><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />");
}
else if (screen.width == 1280) {
document.write("<body background='images/bg660.jpg' onload='JavaScript:setfocus();'><br /><br /><br /><br /><br /><br /><br /><br />");
}
else {
document.write("<body BGcolor='#5A7EDC' onload='JavaScript:setfocus();'><br /><br /><br /><br /><br /><br /><br />");
}
</script>
<div align="center">
<form method="post" action="login.asp" name="FrontPage_Form" onSubmit="JavaScript:return FrontPage_valid();">
<table border="0" cellpadding="0" cellspacing="0" width="548" height="350" id="table11" background="images/log.jpg">
<tr height="50"><th colspan="4" class="Fir">
<% Response.Write (JFrs("Company_Name") & " —— " & JFrs("Software_Name")) %>
</th></tr>
<tr height="36"><th colspan="4" class="warning">
<%
Dim ErrCode
ErrCode = request.QueryString("ErrCode")
If ErrCode = "-1" Then
Response.Write "<li> 您已成功修改账号信息,请等待管理员审核!"
ElseIf ErrCode = "0" Then
Response.Write "<li> 您的帐号已成功注册,请等待管理员审核!"
End If
If ErrCode = "7" Then
Response.Write "<li> [用户名] 不能为空,且至少2个汉字,最多10个汉字"
End If
If ErrCode = "8" Then
Response.Write "<li> [密码] 不能为空,且至少5个字符,最多20个字符"
End If
If ErrCode = "9" Then
Response.Write "<li> [验证码] 错误"
End If
If ErrCode = "10" Then
Response.Write "<li> [用户名] 未注册 或 [密码] 错误"
End If
If ErrCode = "20" Then
Response.Write "<li> 您的账号未通过审核,详情请咨询管理员"
End If
ErrCode = ""
%>
</th></tr>
<tr height="37"><th colspan="4" align="left"></th></tr>
<tr height="38">
<td width="202"></td>
<td width="100" align="right">用户名:</td>
<td width="224"> <input type="text" name="loginName" style="width:160px;height:20px" maxlength="10" title="请输入用户名,至少2个汉字,最多10个汉字" value="<% =request.Cookies("Visiter")("VisitName") %>" onFocus="JavaScript:this.select();" onMouseOver="JavaScript:this.focus();" onClick="Javascript:this.value=''"></td>
<td width="22"></td>
</tr>
<tr height="38">
<td width="202"></td>
<td width="100" align="right">密 码:</td>
<td width="224"> <input type="password" name="loginPassword" style="width:160px;height:20px" maxlength="20" title="请输入密码,至少5个字符"></td>
<td width="22"></td>
</tr>
<tr height="38">
<td width="202"></td>
<td width="100" align="right">验证码:</td>
<td width="224"> <input name="FrontPage_Yzm" style="width:100px;height:20px" maxlength="5" title="请输入5位的验证码">
<% Response.Write (" " & an) %>
</td>
<td width="22"></td>
</tr>
<tr height="54">
<td width="202"></td>
<th colspan="2" valign="middle">
<input type="image" src="images/login.jpg">
<a href="JavaScript:document.FrontPage_Form.reset();"><img border="0" src="images/reset.jpg"></a>
</th>
<td width="22"></td>
</tr>
<tr height="34">
<td width="202"></td>
<th colspan="2">如果您还没有帐号,请点此 <a href="reg.asp?ErrCode=0">注册</a></th>
<td width="22"></td>
</tr>
<tr height="25" class="Sec">
<td width="202" align="center"><% Response.Write (JFrs("Company") & "® 版权所有 ") %>
</td>
<th colspan="3">Copyright&; 2012 All Rights Reserved</th>
</tr>
</table>
</form>
</div>
<script language="JavaScript">
if (screen.width == 1440) {
document.write("<br /><br /><br /><br /><br /><br /><br /><br /><br />");
}
else if (screen.width == 1280){
document.write("<br /><br /><br /><br />");
}
else {
document.write("<br /><br /><br /><br /><br />");
}
</script>
<center>建议使用 IE8.0或更高版本的浏览器,推荐分辨率1440×900 或更高<br />
<%
Response.Write (JFrs("Company") & "® " & JFrs("Software_Name") & " V1.0")
JFrs.Close
set JFrs = Nothing
CloseDataBase
%>
</center>
</body>
</html>
Ⅳ 求html登陆界面详细代码 要可以登陆,用数据库保存
上面给你的是asp的,这边给你个php的,你看下,不懂再问我
<?php
include("config.php");
session_start();
/*--------------------删除cookies记录,让cookies过期-----------------------------------*/
if($_GET["del"]=="cookies")
{
setcookie("usercookies", "", time()-3600);
setcookie("pwdcookies", "", time()-3600);
echo "<SCRIPT type=text/javascript>
var n = 5;
var timer = setInterval(function() {
n--;
document.getElementById('second').innerHTML = n;
if (n == 0) {
clearInterval(timer);
window.location = 'login.php';
}
}, 1000);
</SCRIPT>删除成功<br><B class='chengse STYLE1' id=second>5</B>秒后回到首页";
exit();
}
/*------------------------如果判断已经有cookies存在,则进行自动登录操作----------------------------------*/
if($_COOKIE["usercookies"]!="" and $_COOKIE["pwdcookies"]!="")
{
$username=$_POST["username"];
$userpassword=$_POST["userpassword"];
$sql=mysql_query("select * from user where username='$username' and userpassword='$userpassword'");
$rs=mysql_fetch_array($sql);
echo"自动跳转成功";
//exit();
}
/*----------------------------点击登录按钮后的动作act=login----------------------------------*/
if($_GET["act"]=="login")
{
/*------------------判断获取的验证码是否一致-------------------------*/
/*if(strtoupper($_SESSION["vcode"])!=strtoupper($_POST["Code"]))
{
echo("<script type='text/javascript'> alert('对不起,验证码错误!');location.href='javascript:onclick=history.go(-1)';</script>");
exit();
}*/
/*------------------------点击登录按钮后如果判断已经有cookies存在,则进行自动登录操作----------------------------------*/
if($_COOKIE["usercookies"]!="" and $_COOKIE["pwdcookies"]!="")
{
$username=$_POST["username"];
$userpassword=$_POST["userpassword"];
$sql=mysql_query("select * from user where username='$username' and userpassword='$userpassword'");
$rs=mysql_fetch_array($sql);
if($_POST["username"]==$rs["username"] and $_POST["userpassword"]==$rs["userpassword"])
{
echo"<script type='text/javascript'> alert('存在cookies登录跳转成功!');location.href='javascript:onclick=history.go(-1)';</script>";
exit();
}
else
{
echo"<script type='text/javascript'> alert('存在cookies登录跳转失败!');location.href='javascript:onclick=history.go(-1)';</script>";
exit();
}
exit();
}
/*-------------------点击登录后判断cookies不存在则进行登录比较用户名密码------------------------------*/
$username=$_POST["username"];
$userpassword=md5($_POST["userpassword"]);
$sql=mysql_query("select * from user where username='$username' and userpassword='$userpassword'");
if($rs=mysql_fetch_array($sql))
{
/*---------------------用户名密码判断正确,写入cookies动作,同时进行跳转------------------------------------*/
setcookie("usercookies", $_POST["username"], time()+3600*48);
setcookie("pwdcookies", md5($_POST["userpassword"]), time()+3600*24);
header('Location: http://www..com/');
exit();
}
else
{
/*-------------------判断用户名密码错误,弹出错误提示---------------------------*/
echo "<script type='text/javascript'> alert('用户名或密码错误,请重新输入!');location.href='javascript:onclick=history.go(-1)';</script>";
exit();
}
}
/*
$user_IP = $_SERVER["REMOTE_ADDR"];//获取访问者IP
$file_name=date('Y-m-d').'.txt';//以当前的日期建立txt文件
$file=fopen($file_name,"a+");//如果存在该文件就打开,如果不存在就创建
fwrite($file,$user_IP.'--'.date('Y-m-d H:i:s')."\r\n");//将访问者IP及当前时刻写到文件最后,\r\n在文档最后换行
fclose($file);//关闭文件
*/
?>
<!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=gb2312" />
<title>COOKIES判断是否自动登录</title>
</head>
<body>
<form action="?act=login" method="post">
<input name="username" type="text" id="username" value="<?php if($_COOKIE["usercookies"]!=""){echo $_COOKIE["usercookies"];}?>" />
<input name="userpassword" type="password" id="userpassword" value="<?php if($_COOKIE["pwdcookies"]!=""){echo $_COOKIE["pwdcookies"];}?>"/>
<!--<img src="yanzhengma_class.php" title="看不清楚?请点击刷新验证码" onClick="this.src='yanzhengma_class.php?t='+(new Date().getTime());" height="20px;"><input name="Code" type="text" id="Code" value="" />-->
<input name="" type="submit" />
</form>
<a href="?del=cookies">删除cookies</a>
</body>
</html>
Ⅵ 注册/登陆页面HTML代码该怎么写
以下为个人原创教学例子,任何人引用需注明出自网络知道用户am7972,楼主可供参考x0dx0a该例子涵盖了文本框、密码框、下拉菜单、单选框、复选框及文本区的使用x0dx0a同时在数据的使用方面涵盖了文本型、数值型、日期型、布尔型的使用x0dx0a也涵盖了在会员信息入数据库前,进行严格的数据检查x0dx0a不足处,JS验证还不是太完善,不过有服务端认证足够了x0dx0a
Ⅶ 注册页面html中的登录按钮代码
<input type="button" name="submit" value="Log in" class="left" onclick="OnSubmits()" />
Ⅷ javascript html 设计一个登录界面
注册页面代码:
<!DOCTYPEhtml>
<htmllang="en">
<head>
<metacharset="UTF-8">
<title>注册</title>
</head>
<body>
<formmethod="post"onsubmit="returnfalse"id="form">
<inputtype="text"name="username"placeholder="用户名"><br>
<inputtype="password"name="password"placeholder="密码"><br>
<inputtype="password"name="rePassword"placeholder="再次输入密码"><br>
<inputtype="submit"onclick="register_user()"value="注册"><br>
</form>
<ahref="login.html">去登录</a><script>
varlocalDB=openDatabase('localDB','1.0','TestDB',2*1024*1024);
localDB.transaction(function(ts){
ts.executeSql('CREATETABLEIFNOTEXISTSuser(username,password)')
});
functionregister_user(){
varusername=document.getElementsByTagName("input")[0].value;
varpassword=document.getElementsByTagName("input")[1].value;
varrePassword=document.getElementsByTagName("input")[2].value;
if(password!=rePassword)
{
alert("两次输入的密码不同,请重新输入");
}else
{
localDB.transaction(function(ts){
ts.executeSql("INSERTINTOuser(username,password)VALUES('"+username+"','"+password+"');");
alert("注册成功");
});
}
}
</script>
</body>
</html>
登录页面代码:
<!DOCTYPEhtml>
<htmllang="en">
<head>
<metacharset="UTF-8">
<title>登录</title>
</head>
<body>
<formonsubmit="returnfalse"method="post">
<inputtype="text"placeholder="用户名"><br>
<inputtype="password"placeholder="密码"><br>
<inputtype="submit"value="登录"onclick="login()"><br>
</form>
<ahref="register.html">去注册</a>
<script>
varlocalDB=openDatabase('localDB','1.0','TestDB',2*1024*1024);
localDB.transaction(function(ts){
ts.executeSql("SELECT*FROMuser",[],function(tx,results){
varlen=results.rows.length;
if(len<=0)
{
localDB.transaction(function(ts){
ts.executeSql('CREATETABLEIFNOTEXISTSuser(username,password)')
});
}
});
});
functionlogin(){
varusername=document.getElementsByTagName("input")[0].value;
varpassword=document.getElementsByTagName("input")[1].value;
localDB.transaction(function(ts){
ts.executeSql("SELECT*FROMuserWHEREusername='"+username+"';",[],function(ts,res){
if(res.rows.length<=0)
{
alert("登录失败,用户未注册");
}elseif(password==res.rows[0].password)
{
alert("登录成功,三秒后跳转到网络");
setInterval(function(){
location.href="https://www..com";
},3000);
}else
{
alert("登录失败,密码错误");
}
});
})
}
</script>
</body>
</html>
以上代码使用了WEB SQL,还请选择合适的浏览器查看。