Web Front End Season 4 (jQuery): 7:604-Writing validation rules +605-Completing validation (end of course)

content

First, the purpose

1. Think: learn front-end knowledge

2. Thinking: Take notes, next time you don't need to watch the video, just look at the notes to quickly recall.

2. Reference

1. GitHub URL of my own code

2. SIKI Academy: I refer to this video for practice

3.w3school official website: use it as a dictionary

4. Rookie Tutorial: Use as a Dictionary

5. Web Front End Season 1 (HTML): My own note-taking blog

6. Web Front End Season 2 (CSS): My own note blog

7. Web Front End Season 3 (JavaScript): My own note-taking blog

3. Attention

Action: 1: Success: 604-Write validation check rules

1. Running result: success

Action: 2: Success: 605 - Validation verification completed (end of course)

1. Running result: success


First, the purpose

1. Think: learn front-end knowledge

2. Thinking: Take notes, next time you don't need to watch the video, just look at the notes to quickly recall.

2. Reference

1. GitHub URL of my own code

​​​​​GitHub - xzy506670541/WebTest: Web Frontend for SIKI Academy

2. SIKI Academy: I refer to this video for practice

Login - SiKi Academy - Life is endless, learning is endless!

  1. I refer to this video for practice

3.w3school official website: use it as a dictionary

w3school online tutorials

4. Rookie Tutorial: Use as a Dictionary

Rookie Tutorial - Learning is not only technology, but also a dream!

5. Web Front End Season 1 (HTML): My own note-taking blog

Web Front End Season 1 (HTML): 1:101 - Why Learn Web Front End? +102 - What is HTML? +103-Installation tools and learning methods+04-Create the first web page file Action: Success 1. What is HTML? 1. Why learn HTML? 1. Applicable objects of this course? 1. Relationship between web front-end engineers and back-end 1. What development tools are used? 1. How to study? 1. Operation: The first webpage: 1. Purpose 1. 2. Reference 1. SIKI Academy Login - SiKi Academy - Life is endless, learning is endless! I refer to this video practice 1. Nodepad++ official website https: https://blog.csdn.net/qq_40544338/article/details/120907015

6. Web Front End Season 2 (CSS): My own note blog

Web Front End Season 2 (CSS): 1:101-What is CSS+102-Download and install HBuilder+103-What are div and span tags+104-The difference between block elements and inline elements+105-CSS basic syntax _Smart_zy Blog-CSDN Blog Directory 1. Purpose 1. Think: learn front-end knowledge 2. Think: take notes, you don't need to watch the video next time, just look at the notes to quickly recall. 2. Reference 1. GitHub URL of my own code 1. SIKI Academy: I refer to this video for practice 1. w3school official website: use it as a dictionary 1. Rookie tutorial: use it as a dictionary 3. Note 4. Operation: 1: Success: 101 - What is CSS? 1. Success: Understand what CSS is 4. Operation: 2:102-Download and install HBuilder1. Download: found that the official website does not have HBuilder (already the previous version), all are HBuilderX1. Create a project. https://blog. csdn.net/qq_40544338/article/details/120968455

7. Web Front End Season 3 (JavaScript): My own note-taking blog

Web Front End Season 3 (JavaScript): 1: Chapter 1: JavaScript Basics: 101-What is the JavaScript language +102-Write the first JavaScript code +103-Three ways to write js code_Smart_zy's Blog-CSDN Blog directory 1. Purpose 1. Think: learn front-end knowledge 2. Think: take notes, next time you don't need to watch the video, just look at the notes to quickly recall. 2. Reference 1. GitHub URL of my own code 1. SIKI Academy: I refer to this video for practice 1. W3school official website: use it as a dictionary 1. Rookie tutorial: use it as a dictionary 3. Note 4. Operation: 1: Success: 101 - What is the JavaScript language 1. Introduction to JS 4. Operation: 2: Success: 102-Write the first JavaScript code 1. New project: 1. Running result: Success: Jump out of the warning window 4. Operation: 3: Success: 103- Writing j. https://blog.csdn.net/qq_40544338/article/details/121351279

3. Attention

Action: 1: Success: 604-Write validation check rules

1. Running result: success

Form validation
1, jQuery plug-in validation: https://jqueryvalidation.org/
a. Internationalization (prompt information supports multiple languages)
b. Validation is a jQuery-based plug-in, which contains some jQuery functions and functions.
2. Syntax
$(xx).validate({ rules:{}, messages:{} }); 3, rules:{ username:{ required:true, minlength:9, digits:true , equalTo :"[name='reusername'] " }, password:{...} }











4. If there are no messages, an English prompt will be given by default. If
the internationalized message.js file is introduced, you can also not write messages
messages:{ username:{ required: "User name must be filled in", minlength: "The minimum length is 9 digits", digits:"must consist of digits" }, password:{...} } 5, radio button handling: <label for="sex" class="error" style="display: none;"> </label>








 

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>

		<script type="text/javascript" src="js/jquery-3.3.1.js"></script>
		<script type="text/javascript" src="js/jquery.validate.min.js"></script>
		<script type="text/javascript" src="js/messages_zh.min.js"></script>

		<script type="text/javascript">
			var validateRule = {
				rules: {
					// 对username的键值进行规则
					username: {
						required: true,
						minlength: 3,
						maxlength: 6
					},
					email: {
						required: true,
						email: true
					},
					password: {
						required: true,
						minlength: 3,
						maxlength: 6
					},
					rePassword: {
						required: true,
						equalTo: "[name='password']"
					},
					birthday: {
						date: true
					},
					sex:{
						required:true
					}
				}
			};

			$(function() {
				$("#registerForm").validate(validateRule);
			});
		</script>
	</head>
	<body>
		<form action="register.jsp" id="registerForm">
			<table border="1" width="800px" height="500px">
				<tr>
					<td colspan="2" align="center">注册</td>
				</tr>
				<tr>
					<td align="right" width="100px">用户名:</td>
					<td align="left"> <input type="text" name="username" />

					</td>
				</tr>
				<tr>
					<td align="right">邮箱:</td>
					<td> <input type="text" name="email" /></td>
				</tr>
				<tr>
					<td align="right">密码:</td>
					<td> <input type="password" name="password" /> </td>
				</tr>
				<tr>
					<td align="right">重复密码:</td>
					<td> <input type="password" name="rePassword" /> </td>
				</tr>
				<tr>
					<td align="right">出生年月日:</td>
					<td> <input type="text" name="birthday" /> </td>
				</tr>
				<tr>
					<td align="right">性别:</td>
					<td> 男 <input type="radio" name="sex" /> 女 <input type="radio" name="sex" />
						<label for="sex" class="error"></label>
					</td>
				</tr>
				<tr>
					<td colspan="2" align="center"> <input type="submit" value="注册" /> </td>
				</tr>
			</table>
		</form>
	</body>
</html>

Action: 2: Success: 605 - Validation verification completed (end of course)

1. Running result: success

 

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>

		<script type="text/javascript" src="js/jquery-3.3.1.js"></script>
		<script type="text/javascript" src="js/jquery.validate.min.js"></script>
		<script type="text/javascript" src="js/messages_zh.min.js"></script>

		<script type="text/javascript">
			var validateRule = {
				rules: {
					// 对username的键值进行规则
					username: {
						required: true,
						minlength: 3,
						maxlength: 6
					},
					email: {
						required: true,
						email: true
					},
					password: {
						required: true,
						minlength: 3,
						maxlength: 6
					},
					rePassword: {
						required: true,
						equalTo: "[name='password']"
					},
					birthday: {
						date: true
					},
					sex: {
						required: true
					}
				},

				// 自定义提示信息内容:代码格式和rules是差不多的
				messages: {
					username: {
						required: "自定义提示:这个是必须填写的",
						minlength: "自定义提示:最少输入3个字符!",
						maxlength: "自定义提示:最多输入6个字符!"
					}
				}
			};

			$(function() {
				$("#registerForm").validate(validateRule);
			});
		</script>
	</head>
	<body>
		<form action="register.jsp" id="registerForm">
			<table border="1" width="800px" height="500px">
				<tr>
					<td colspan="2" align="center">注册</td>
				</tr>
				<tr>
					<td align="right" width="100px">用户名:</td>
					<td align="left"> <input type="text" name="username" />

					</td>
				</tr>
				<tr>
					<td align="right">邮箱:</td>
					<td> <input type="text" name="email" /></td>
				</tr>
				<tr>
					<td align="right">密码:</td>
					<td> <input type="password" name="password" /> </td>
				</tr>
				<tr>
					<td align="right">重复密码:</td>
					<td> <input type="password" name="rePassword" /> </td>
				</tr>
				<tr>
					<td align="right">出生年月日:</td>
					<td> <input type="text" name="birthday" /> </td>
				</tr>
				<tr>
					<td align="right">性别:</td>
					<td> 男 <input type="radio" name="sex" /> 女 <input type="radio" name="sex" />
						<label for="sex" class="error"></label>
					</td>
				</tr>
				<tr>
					<td colspan="2" align="center"> <input type="submit" value="注册" /> </td>
				</tr>
			</table>
		</form>
	</body>
</html>

Guess you like

Origin blog.csdn.net/qq_40544338/article/details/122186403