-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify.html
More file actions
86 lines (72 loc) · 2.76 KB
/
Copy pathverify.html
File metadata and controls
86 lines (72 loc) · 2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style></style>
<script src="jquery-1.11.2.min.js"></script>
<script>
jQuery.verifyTest = function() {
$("input[test]").on("blur", function() {
if($(this).next("i").prop("tagName") == "I") {
$(this).next("i").remove();
}
if($(this).val() == "") {
$(this).after("<i style='color:#C00000' test class='verify'>"+$(this).attr("test")+" 不可为空</i>");
$(this).css("border","2px solid #C00000").focus();
}else {
$(this).next("i").remove();
$(this).css("border","1px solid #CCC");
}
})
}
jQuery.verifyTestSaveButAfter = function() {
var testArray = [];
$("input[test]").each(function(index, el) {
if($(this).next("i").prop("tagName") == "I") {
$(this).next("i").remove();
}
if($(this).val() == "") {
$(this).after("<i style='color:#C00000' test class='verify'>"+$(this).attr("test")+" 不可为空</i>");
$(this).css("border","2px solid #C00000").focus();
testArray.push(0)
}else {
$(this).next("i").remove();
$(this).css("border","1px solid #CCC");
testArray.push(1)
}
});
if($.inArray(0,testArray) == -1) {
return false;
}else {
return true;
}
}
</script>
<script>
$.verifyTest();
$("#save").on("click", function() {
if($.verifyTestSaveButAfter())return;
// 保存代码
alert("保存");
})
showConfirm({"code":"确定要 删除 吗?","message":""}, function(use) {
console.log(use.attr("data-id"));
},$(this));
var ttt = 0;
showAlert({"code":"确定要 删除 吗?","message":""}, function(use) {
console.log(use);
},ttt);
</script>
</head>
<body>
姓名:<input class="" id="stationName1" test="姓名" value="" type="text"/>
年龄:<input class="" id="stationName2" test="年龄" value="" type="text"/>
说明:<input class="" id="stationName3" test="说明" value="" type="text"/>
说明:<input class="" id="stationName3" value="" type="text"/>
说明:<input class="" id="stationName3" value="" type="text"/>
说明:<input class="" id="stationName3" value="" type="text"/>
说明:<input class="" id="stationName3" value="" type="text"/>
说明:<input class="" id="stationName3" value="" type="text"/>
说明:<input class="" id="stationName3" test="说明" value="" type="text"/>
<input class="" id="save" value="提交" type="button"/>
</body>
</html>