格式化代码
This commit is contained in:
parent
5ea2a40ec4
commit
295f24b49b
@ -1,5 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
@ -9,6 +10,7 @@
|
||||
<script src="./js/index.js"></script>
|
||||
<title>基于jQuery的AJAX实现三级联动菜单</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div>
|
||||
<form>
|
||||
@ -46,4 +48,5 @@
|
||||
|
||||
})
|
||||
</script>
|
||||
|
||||
</html>
|
@ -1,4 +1,3 @@
|
||||
|
||||
function getData() {
|
||||
$.ajax({
|
||||
url: './json/third-level-address.json',
|
||||
@ -18,22 +17,10 @@ function getData(){
|
||||
|
||||
function getCountry() {
|
||||
var data = getData();
|
||||
var country = new Array();
|
||||
var children = new Array();
|
||||
var countryCode=new Array();
|
||||
$.each(data,function(i,tmp){
|
||||
countryCode.push(tmp.code);
|
||||
country.push(tmp.name);
|
||||
children.push(tmp.children);
|
||||
});
|
||||
// for(var i in data){
|
||||
// console.log(data[i].children[0].children.length);
|
||||
// }
|
||||
var options = "<option value='0'>--请选择--</option>";
|
||||
for (var i in data) {
|
||||
options += "<option value='" + data[i].code + "' selected>" + dataJson[i].name+"</option>";
|
||||
options += "<option value='" + data[i].code + "' selected>" + data[i].name + "</option>";
|
||||
$("#province").html(options);
|
||||
// console.log(data[i].code);
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,6 +39,7 @@ function getCity(countryCode){
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function getArea(cityCode) {
|
||||
var data = getData();
|
||||
var options = "<option value='0'>--请选择--</option>";
|
||||
|
@ -1,5 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
@ -10,6 +11,7 @@
|
||||
<title>jQuery-表单验证</title>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="main">
|
||||
<form action="form" onsubmit="return func();">
|
||||
@ -21,23 +23,15 @@
|
||||
<input type="text" required="required" class="Username">
|
||||
<span class="info1">Username</span>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="inputBox1">
|
||||
<input type="text" required="required" class="Email">
|
||||
|
||||
<span class="info2">Email</span>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="inputBox">
|
||||
<input type="password" required="required" class="Password">
|
||||
|
||||
<span class="info3">Password</span>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<button class="enter" type="submit">Enter</button>
|
||||
@ -64,6 +58,7 @@
|
||||
|
||||
|
||||
})
|
||||
|
||||
function func() {
|
||||
|
||||
var flag1 = $('.Username').tooltip('userName');
|
||||
@ -78,7 +73,6 @@
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</html>
|
@ -1,4 +1,5 @@
|
||||
;(function ($) {
|
||||
;
|
||||
(function ($) {
|
||||
|
||||
var methods = {
|
||||
//用户名验证
|
||||
@ -13,15 +14,13 @@
|
||||
// $(".info1").css('color','#000');
|
||||
$(".info1").show().html(info);
|
||||
return false;
|
||||
}
|
||||
else if (this.val().match(reg)) {
|
||||
} else if (this.val().match(reg)) {
|
||||
$(".info1").css('color', 'green');
|
||||
// $(".info1").css('background','#fff');
|
||||
$(".info1").show().html(success);
|
||||
return true;
|
||||
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$(".info1").css('color', 'red');
|
||||
$(".info1").show().html(error);
|
||||
return false;
|
||||
@ -39,13 +38,11 @@
|
||||
// $(".info1").css('color','#000');
|
||||
$(".info3").show().html(info);
|
||||
return false;
|
||||
}
|
||||
else if (this.val().match(reg)) {
|
||||
} else if (this.val().match(reg)) {
|
||||
$(".info3").css('color', 'green');
|
||||
$(".info3").show().html(success);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$(".info3").css('color', 'red');
|
||||
$(".info3").show().html(error);
|
||||
return false;
|
||||
@ -63,13 +60,11 @@
|
||||
// $(".info1").css('color','#000');
|
||||
$(".info2").show().html(info);
|
||||
return false;
|
||||
}
|
||||
else if (this.val().match(reg)) {
|
||||
} else if (this.val().match(reg)) {
|
||||
$(".info2").css('color', 'green');
|
||||
$(".info2").show().html(success);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$(".info2").css('color', 'red');
|
||||
$(".info2").show().html(error);
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user