script type="text/javascript" src="../js/jquery-1.4.1.min.js"/script

我們提供的服務(wù)有:成都做網(wǎng)站、成都網(wǎng)站設(shè)計、成都外貿(mào)網(wǎng)站建設(shè)、微信公眾號開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、鎮(zhèn)巴ssl等。為近1000家企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的鎮(zhèn)巴網(wǎng)站制作公司
script type="text/javascript" src="../js/jquery.validate.min.js"/script
script type="text/javascript"
$(function(){
$("#f").validate({
rules:{
email:{
required:true,
email:true
},
nickname:{
required:true,
minlength:4,
maxlength:20
},
password:{
required:true,
minlength:6,
maxlength:20
},
password1:{
required:true,
equalTo:"#txtPassword"
},
number:{
required:true,
remote:"checkCode.action" }
},
messages:{
email:{
required:"登錄名必須填寫",
email:"請?zhí)顚懻_的Email格式"
},
nickname:{
required:"昵稱必須填寫",
minlength:"昵稱長度不得小于4位",
maxlength:"昵稱長度不得超過20位"
},
password:{
required:"密碼必須填寫",
minlength:"密碼長度不得小于6位",
maxlength:"密碼長度不得超過20位"
},
password1:{
required:"請輸入密碼驗證",
equalTo:"必須與上面密碼相同"
},
number:{
required:"驗證碼必須填寫",
remote:"驗證碼輸入錯誤"
}
}
});
});
/script
這是用jquery的一個jquery.validate.min.js插件寫的 其實可以用js完成
效果圖
代碼
!DOCTYPE?html
html
head
meta?charset="UTF-8"
title先鋒圖書館管理系統(tǒng)-登錄/title
style
*{
margin:?0;
padding:?0;
list-style:?none;
}
#top{
width:?1000px;
height:?95px;
margin:?0?auto;
margin-top:?25px;
}
#top_top{
width:?1000px;
height:?65px;
background:?deepskyblue;
}
#top_top_left{
width:?300px;
height:?65px;
float:?left;
}
#top_top_leftlabel{
width:?200px;
height:?65px;
color:?white;
float:?right;
}
#top_top_left#a2{
padding-left:?10px;
padding-top:?20px;
font-size:?16px;
}
#top_bottom{
width:?1000px;
height:?30px;
}
#top_bottom_left{
width:?340px;
height:?30px;
line-height:?30px;
font-size:?12px;
background:?skyblue;
color:?white;
text-indent:?2em;
float:?left;
}
#top_bottom_right{
width:?660px;
height:?30px;
line-height:?30px;
font-size:?12px;
color:?blueviolet;
text-align:?center;
float:?right;
background:?lightskyblue;
}
#content{
width:?1000px;
height:?600px;
margin:?0?auto;
background:#587FBA;
}
#content#text{
width:?1000px;
height:?50px;
line-height:?50px;
padding-top:?100px;
font-size:?36px;
font-family:"楷體";
font-weight:?bold;
text-align:?center;
}
#content#login{
width:?480px;
height:?210px;
margin-top:?20px;
margin-left:?260px;
background:?#85A0CB;
}
#content#loginimg{
float:?left;
}
#content#login#select{
width:?305px;
height:?210px;
float:?right;
}
#content#login#selectdiv{
width:?230;
height:?30px;
margin-left:?30px;
}
#content#login#select#d1{
margin-top:30px;
margin-bottom:?3px;
}
#content#login#selectp{
font-size:?14px;
margin-left:?95px;
}
#bottom{
width:?1000px;
height:?35px;
line-height:?35px;
margin:?0?auto;
background:?deepskyblue;
text-align:?center;
color:?white;
}
/style
/head
body
div?id="top"
div?id="top_top"
div?id="top_top_left"
img?src="img/test/a13.png"?width="78px"?height="65px"label?id="a2"先鋒圖書館系統(tǒng)管理平臺/label
/div
/div
div?id="top_bottom"
div?id="top_bottom_left"當(dāng)前位置?:?首頁??系統(tǒng)管理??登錄/div
div?id="top_bottom_right"當(dāng)前時間?:?label?id="lable"/label/div
/div
/div
div?id="content"
div?id="text"歡迎登錄先鋒圖書館管理系統(tǒng)/div
div?id="login"
img?src="img/test/a14.png"??width="175px"?height="210px"/
form?id="select"
div?id="d1"用戶名:?nbsp;nbsp;input?type="text"?//div
div密????nbsp;?碼:?nbsp;nbsp;input?type="password"?//div
p
input?type="radio"?name="user"?value="read"/讀者nbsp;nbsp;nbsp;nbsp;
input?type="radio"?name="user"?value="admin"/管理員
/pbr/
p
input?type="button"?value="確定"?style="width:?50px;"?onclick="put()"/nbsp;nbsp;nbsp;nbsp;
input?type="reset"?value="重置"?style="width:?50px;"/
/p
/form
/div
/div
div?id="bottom"欣欣科技有限公司版權(quán)所有/div
/body
script?type="text/javascript"?src="JQuery/jquery.js"/script
script?type="text/javascript"?src="js/GetCurrentTime.js"/script
script
//驗證用戶名和密碼
function?put(){
var?d?=?$("#selectdivinput");//獲取用戶名和密碼
var?name?=?d[0].value;
var?pass?=?d[1].value;
var?user?=?null;
var?r?=?document.getElementsByName("user");//獲取用戶類型
for(i=0;ir.length;i++){
if(r[i].checked){
user=r[i].value;
}
}
//console.log(name?+?","?+pass?+?","?+user);//輸出測試
if(user==null){
window.alert("請選擇用戶類型!");
}else?if(user=="admin"??name!="admin"){
window.alter("用戶名錯誤!");
}else?if(user=="admin"??name=="admin"??pass!="123456"){
window.alert("密碼錯誤!");
}else?if(name=="admin"??pass=="123456"??user=="admin"){
window.location.href="work_02_welcome.html";//在js中在本頁面中打開新鏈接
}else{
window.alert("用戶名錯誤");
}
}
/script
/html
Java寫提示注冊成功的方法如下:
1、首先用戶注冊完成后,返回一個boolean值的變量;
2、利用Servlet類判斷這個變量,如果為true,跳轉(zhuǎn)到提示界面,提示用戶注冊成功,如果為false,跳轉(zhuǎn)到提示界面,提示用戶注冊失敗;
3、具體代碼如下所示:
public?class?DemoServlet?extends?HttpServlet?{
public?void?doGet(HttpServletRequest?request,?HttpServletResponse?response)
throws?ServletException,?IOException?{
String?username?=?request.getParameter("username");
String?usepwd=?request.getParameter("usepwd");
boolean?flag?=?Dao.register(username,usepwd);//注冊方法
if(flag){
//提示注冊成功
request.getRequestDispatcher("/success.jsp").forward(request,?response);
}else{
//提示注冊失敗
request.getRequestDispatcher("/success.jsp").forward(request,?response);
}
}
public?void?doPost(HttpServletRequest?request,?HttpServletResponse?response)
throws?ServletException,?IOException?{
doGet(request,?response);
}
}
4、至此,就完成了提示注冊成功的功能。
你這個不用數(shù)據(jù)庫真的是有點難搞
我寫了個用集合存儲的,你看看,能否幫上你
java.util.ListString?list?=?new?ArrayListString();
list.add("qq=123");//存儲的時候用(用戶名=密碼)的形式
list.add("ww=456");
String?username?=?"qq";
String?password?=?"123";
for?(int?i?=?0;?i??list.size();?i++)?{
String?num?=?username?+"="+password;
if(num.equals(list.get(i))){
System.out.println("登錄成功");
break;
}
}
這篇文章主要介紹了java通過JFrame做一個登錄系統(tǒng)的界面完整代碼示例,具有一定借鑒價值,需要的朋友可以參考下。
在java的JFrame內(nèi)通過創(chuàng)建匿名對象的方式做登錄界面
package com.sxt;
import java.awt.Container;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
public class LoginFrame extends JFrame{
JTextField txtname=new JTextField();
JPasswordField txtpass=new JPasswordField();
JButton bl=new JButton("登錄");
JButton bg=new JButton("關(guān)閉");
//構(gòu)造無參構(gòu)造器把主要的方法放在構(gòu)造器里,然后在main方法里面調(diào)
public LoginFrame(){
setBounds(25,25,250,250);
Container c = getContentPane();
c.setLayout(new GridLayout(4,2,10,10));
c.add(new JLabel("用戶名"));
c.add(txtname);
c.add(new JLabel("密碼"));
c.add(txtpass);
c.add(bl);
c.add(bg);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setVisible(true);
//注意:此處是匿名內(nèi)部類
bg.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
System.exit(0);
}
}
);
//注意:此處是匿名內(nèi)部類
bl.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
標(biāo)題名稱:網(wǎng)站注冊代碼java,網(wǎng)站注冊登錄代碼
地址分享:http://chinadenli.net/article41/dsgojed.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站制作、網(wǎng)站建設(shè)、App開發(fā)、云服務(wù)器、網(wǎng)站設(shè)計公司、網(wǎng)站設(shè)計
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)