導航:首頁 > 編程語言 > jquery登錄代碼

jquery登錄代碼

發布時間:2023-02-26 07:02:00

㈠ 請問如何寫一個用JQuery寫一個判斷用戶密碼代碼

<!doctypehtml>
<htmllang="en">
<head>
<metacharset="UTF-8">
</head>
<body>
用戶名:<inputid="userName">
密碼:<inputtype="password">
密碼:<inputtype="password">
<buttononclick="sub()">注冊</button>
<scriptsrc="jquery-2.1.1.min.js"></script>
<script>
varuserName,
password,
password2;
functionsub(){
userName=$('#userName').val();
password=$('input[type="password"]')[0].value;
password2=$('input[type="password"]')[1].value;

if(userName.length<4||userName.length>10){
alert('用戶名長度為4~10位');
return;
}

if(!password||!password2){
alert('密碼為空');
return;
}

if(password!==password2){
alert('兩次密碼輸入不一樣,請重新輸入');
return;
}

alert('注冊成功');

}
</script>
</body>

</html>

㈡ 剛剛學JQuery,請問怎麼寫一個JQuery驗證登錄密碼的,代碼應該怎麼寫,急

頁面代碼:
<input type="password" name="pass" id="pass" />
<span id="passstrength"></span>
以下是JS代碼:
$('#pass').keyup(function(e) {
var strongRegex = new RegExp("^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$", "g");
var mediumRegex = new RegExp("^(?=.{7,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$", "g");
var enoughRegex = new RegExp("(?=.{6,}).*", "g");
if (false == enoughRegex.test($(this).val())) {
$('#passstrength').html('More Characters');
} else if (strongRegex.test($(this).val())) {
$('#passstrength').className = 'ok';
$('#passstrength').html('Strong!');
} else if (mediumRegex.test($(this).val())) {
$('#passstrength').className = 'alert';
$('#passstrength').html('Medium!');
} else {
$('#passstrength').className = 'error';
$('#passstrength').html('Weak!');
}
return true;
});

㈢ 仿百度登陸彈窗的JS或者jquery代碼 求詳細

<!DOCTYPEhtml>
<html>
<head>
<metacharset="utf-8"/>
<title>div布局</title>

<scripttype="text/javascript"src="http://libs..com/jquery/1.3.2/jquery.min.js"></script>

<styletype="text/css">
.corInsertHref
{
position:absolute;
z-index:10000;
width:370px;
float:left;
display:none;
background-color:#fff;
padding:10px;
}
.corBackground
{
width:100%;
height:100%;
position:absolute;
background-color:#000;
top:0;
left:0;
filter:alpha(opacity=30);
-moz-opacity:0.30;
-khtml-opacity:0.30;
opacity:0.30;
z-index:9999;
display:none;
}
</style>

<scripttype="text/javascript">
$(function(){
//點擊登錄按鈕彈出層並初始化彈出層位置
$("#btnlogin").click(function(){
$("#corBackground").animate({opacity:"show"},"slow");
$("#corInsertHref").animate({opacity:"show"},"slow");
autoSize($("#corInsertHref"));
});
//窗口大小縮放事件
$(window).resize(function(){
autoSize($("#corInsertHref"));
});
//窗口大小縮放時調整彈出層的位置
varautoSize=function(corObj){
varwWidth=$(window).width(),wHeight=$(window).height();
varihWidth=corObj.outerWidth(true),ihHeight=corObj.outerHeight(true);

corObj.css({"top":((wHeight-ihHeight)/2)+"px","left":((wWidth-ihWidth)/2)+"px"});
}
});
</script>

</head>
<body>
<spanid="btnlogin">登錄</span>
<divid="corInsertHref"class="corInsertHref">
<p>
賬號<inputid="txtName"type="text"/></p>
<p>
密碼<inputid="txtPwd"type="text"/></p>
<p>
<inputtype="button"value="登錄"/></p>
</div>
<divid="corBackground"class="corBackground">
</div>
</body>
</html>

粗略的寫了下,可以嗎?

㈣ 利用 jquery ajax做一個用戶登錄界面

a頁面關鍵JS代碼:
function che(username,pwd){
$.ajax({
url:"b.aspx",
type:"POST",
data:{user:username,pwd:pwd},
dataType:"XML",
success: function (data,status){
var count=$(data).find("num").text();
if(count==0){ //沒有注冊
$("#lab2").html("未注冊,不能登錄");
}
else{ //已經注冊
$("#lab2").html("可以登錄");
……
} //else
} //success
}); //ajax
}
b頁面中要返回xml數據,拼字元串就可以
string user = Request["user"].ToString(); //獲取用戶名
string pwd = Request["pwd"].ToString(); //獲取密碼
count=根據用戶名和密碼查詢出來的記錄數
//sql語句:select count(*) from login where username=user and password=pwd
string str = "<?xml version='1.0' ?>";
str += "<num>" + count + "</num>";
Response.Write(str);
Response.End();

閱讀全文

與jquery登錄代碼相關的資料

熱點內容
網路中常用的傳輸介質 瀏覽:518
文件如何使用 瀏覽:322
同步推密碼找回 瀏覽:865
樂高怎麼才能用電腦編程序 瀏覽:65
本機qq文件為什麼找不到 瀏覽:264
安卓qq空間免升級 瀏覽:490
linux如何刪除模塊驅動程序 瀏覽:193
at89c51c程序 瀏覽:329
怎麼創建word大綱文件 瀏覽:622
裊裊朗誦文件生成器 瀏覽:626
1054件文件是多少gb 瀏覽:371
高州禁養區內能養豬多少頭的文件 瀏覽:927
win8ico文件 瀏覽:949
仁和數控怎麼編程 瀏覽:381
項目文件夾圖片 瀏覽:87
怎麼在東芝電視安裝app 瀏覽:954
plc顯示數字怎麼編程 瀏覽:439
如何辨別假網站 瀏覽:711
寬頻用別人的賬號密碼 瀏覽:556
新app如何佔有市場 瀏覽:42

友情鏈接