<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<form action="" method="post">
<input type="text" name="username" id="">
<input type="password" name="pwd" id="" required minlength="4" maxlength="8" > <!-- 此处限制了最小长度为4,最大长度为8,但是不可靠,因为可以在网页上修改 -->
<input type="password2" name="pwd2" id="" required minlength="4" maxlength="8" pattern="[a-z][4,8]"> <!-- 正则表达式,只能用字母,长度为4-8 -->
<input type="password3" name="pwd3" id="" required minlength="4" maxlength="8" pattern="[a-z][4,8]" placeholder="请输入密码"> <!-- 注重用户体验---必写 -->
<input type="reset" value="重置"> <!-- 重置输入的内容 -->
<input type="email" name="email" id="">
<input type="submit" value="go">
</form>
<label for="pet select">宠物:</label> <!-- 下拉菜单 -->
<select id="pet select" name="pet select">
<option value="">请选择一项</option>
<option value="dog">狗</option>
<option value="cat">猫</option>
</select>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div><script>alert('消息')</script></div> <!-- 网页弹窗显示 -->
<textarea>666</textarea> <!-- 多行文本输入 -->
<input id="prodid" name="prodid" type="hidden" value="23456"> <!-- hidden可以防止csrf---伪造表单提交。产生csrf原因:服务器没有对用户进行身份验证 -->
<!-- 原理:服务器会给用户发送token,浏览器会把token放到value里进行身份验证,但是黑客不知道token -->
</body>
</html>
utf-8编码规则
1.判断字符占几个字节(Unicode码)
0-127 一字节 0xxxxxxx
128-2027 二字节 110xxxxx 10xxxxxx
2048-65535 三字节 1110xxxx 10xxxxxx 10xxxxxx
2.将Unicode码点转化为二进制,然后将二进制向对应的字节规则上从后向前补位(0xxxxxxx中的xxx,如果二进制不够补位,则将x转换成0)
3.再将二进制转化为16进制
例:‘’中‘’转化为utf8
python:print(ord('中'));
20013 --- 属于三字节
转化为二进制
20013 --- 0100111000101101
将二进制填入
11100100 10111000 10101101
在转化为18进制后得
e4 b8 ad
js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<p id="demo">aaaabc</p>
<input type="text" name="username" onclick="alert(1)">acc</input> <!-- 点击的时候弹出弹窗 -->
<img src="123" onerror="alter(321)">
</body>
<script type="text/javascript">
alert(1) /* 除数字外都要加双引号 */
confirm(1)
prompt(1) /* 反应写的内容 */
</script>
</html>
几个注释符
//
/**/
<!-- -->
-->
-->x=2 /* 注释符一定要和注释写在同一行否则不生效 */
console.log(x);
-->
x=2 /* 注释符一定要和注释写在同一行否则不生效 */
console.log(x);
== (相等运算符)--- 只判断值相不相等 x==y
=== (严格相等运算符)--- 判断类型和值相不相等 x===y
var x='1';
var y=1;
if(x==y){
console.log(x)
}
var x='1';
var y=1;
if(x===y){
console.log(x)
}