day55 Pyhton 前端Jquery07
昨日回顾:
表单,点击submit提交以后,服务端受到信息
import socket
import pymysql
from urllib.parse import unquote def run():
sock = socket.socket()
sock.bind(('127.0.0.1', 8081))
sock.listen(5)
''' 'GET /?username=alex&pwd=123 HTTP/1.1
Host: 127.0.0.1:8081
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Referer: http://localhost:63342/01-lesson/%E9%9D%99%E6%80%81%E7%BD%91%E7%AB%99/index.html?_ijt=726h7dpjc8l6d6gqbjfmee6tor
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Cookie: csrftoken=B6UX45uX3HeZyEBYfT0RKStoBqOF72qMYTT432aoeAyGK6uUcAbfjmbmkiBXlDxY; sessionid=pqwpjn15zp78cioj0pjfruelqalbhbwh ' b'GET / HTTP/1.1
Host: 127.0.0.1:8080
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Cookie: csrftoken=mgGu1nqxXnaKpGHTzlmFYyqlXl2Rv1SymNNzriypOCIeYylosvpj4jAR1XO0ZuFr; sessionid=zah393kzpbu3aelh039oh9236ynndq98 '
''' while True:
conn, addr = sock.accept() # hang住
# 有人来链接了
# 获取用户发送的数据
data = conn.recv(8096)
# print(data)
data = str(data, encoding='utf-8') print('======', data)
headers, bodys = data.split('\r\n\r\n')
tem_list = headers.split('\r\n')
# 获取请求方式 url 和协议
method, url, protocal = tem_list[0].split(' ')
# 获取路由地址和?之后的内容
path, query = url.split('?') # 获取到用户名和密码
name = query.split('&')[0].split('=')[1]
pwd = query.split('&')[1].split('=')[1] # 将url编码转义成中文
name = unquote(name)
print('---------', name, pwd) # 写入数据库
conn1 = pymysql.connect(
host='127.0.0.1',
user='root',
password="",
database='d1',
port=3306,
charset='utf8'
)
cur = conn1.cursor(pymysql.cursors.DictCursor)
sql = 'insert into user value (%(username)s,%(password)s)'
cur.execute(sql, {"username": name, 'password': pwd}) conn1.commit()
conn.send(b'HTTP/1.1 200 OK\r\n\r\n') with open('index.html','rb') as f:
a = f.read()
conn.send(a) # conn.send(b'112113') conn.close() if __name__ == '__main__':
run()
今日内容
1.BOM
-window.open(url,target)
-location
href 跳转的网址
host 主机名,包括端口
hostname 主机名
pathname url 中的路径部分
protocol 协议 一般是http.https
search 查询字符串
reload() 重载页面 全局刷新
-history
history.go(-1) 后端一步
-XMLHttpRequest
//两秒之后打开百度
setTimeout(function () { // window.open('http://www.baidu.com','_self');
/*
*
* host 主机名,包括端口 hostname 主机名 pathname url中的路径部分 protocol 协议 一般是http、https search 查询字符串
*
* */
console.log(location.host);//localhost:63342
console.log(location.pathname);///python_qishi/day29/01%20BOM.html
console.log(location.protocol);//http:
console.log(location.search);//?_ijt=36ujga8q9f3keptgp6867h102g // location.href = 'http://www.baidu.com';//重定向
// 重载页面 全局刷新 测试
// location.reload();//刷新网页 // history.go(-1);//后退一步
},2000)
2.Jquery介绍
-核心思想
write less,do more
- 什么是jquery?
jQuery是一个快速,小巧,功能丰富的JavaScript库。
它通过易于使用的API在大量浏览器中运行,使得HTML文档遍历和操作,事件处理,动画和Ajax更加简单。
通过多功能性和可扩展性的结合,jQuery改变了数百万人编写JavaScript的方式
3.jquery下载
https://www.bootcdn.cn/jquery/
4.jquery的引入
先引入jquery
再写的js脚本
<meta charset="UTF-8">
<title>Title</title>
<script src="./js/jquery.js"></script>
5.jquery和js区别
js包含jquery。
jquery只是封装文档遍历和操作,事件处理,动画和Ajax
6.jquery的选择器
css的选择器的作用:命中标签
jquery的选择器:命中DOM
-基础选择器
-高级选择器
<button>按钮</button>
<button>按钮2</button>
<button>按钮3</button>
<button>按钮4</button>
<button>按钮5</button>
<button>按钮6</button>
<button>按钮7</button>
<div class="box" id="box">alex</div> <script> //id选择器
console.log($('#box'))
//.style.color = 'red'
$('#box').css('color', 'red');
$('#box').css({
"color": 'red',
"background-color": "green"
}); //类选择器
console.log($('.box').css('color')); //标签选择器 jquery 内部遍历
$('button').click(function () {
// this 指的jsDOM对象 //jsDOM对象===》jquery对象
console.log($(this));
//jquery对象===》jsDom对象
console.log($('button').get(1)===this);
console.log(this); // this.style.color = 'red'; $(this).css('color','darkgreen'); })
7.jquery和js对象的转换
- //jsDOM对象===> jquery对象
console.log($(this));
//jquery对象===>jsDom对象
console.log($('button').get(0)===this);
// 入口函数
//window.onload 事件覆盖
// window.onload = function () {
// alert(1)
// };
// window.onload = function () {
// alert(2)
// };//弹窗弹出2覆盖了1 $(document).ready(function () {
console.log($('#dj'));
});//在文档加载后激活函数 $(function () {
// 后代选择器
$('#dj~p')
}) </script> </head>
<body>
<div class="box">
<p id="dj">
得劲
</p>
<p>
alex
</p>
<p class="box">
家辉
</p>
</div> </body>
8.jquery动画
#普通动画
$('.box').stop().hide(3000);
#卷帘门效果
$('.box').stop().slideDown(1000);
$('.box').stop().slideToggle(1000);
#淡入淡出
$('.box').stop().fadeOut(2000);
$('.box').stop().fadeToggle(2000)
<meta charset="UTF-8">
<title>Title</title>
<script src="./js/jquery.js"></script>
<style>
.box{
width: 300px;
height: 300px;
background-color: red;
display: block;
}
</style> </head>
<body>
<button>动画</button>
<div class="box"></div>
<script> let ishide = true;
$('button').mouseenter(function () {
// if(ishide){
// $('.box').stop().hide(3000);
// ishide = false;
// }else{
// $('.box').stop().show(1000);
// ishide = true;
// } // $('.box').stop().toggle(1000); //卷帘门效果
// // $('.box').stop().slideDown(1000);
// $('.box').stop().slideToggle(1000); //淡入淡出
$('.box').stop().fadeOut(2000);
$('.box').stop().fadeToggle(2000); })
</script>
day55 Pyhton 前端Jquery07的更多相关文章
- day56 Pyhton 前端Jquery08
前端 内容回顾: -BOM -jquery介绍 -jquery下载和引入方式 npm install jquery -jquery的选择器 -基本选择器 -通配符选择器 - id选择器 - 类选择器 ...
- day50 Pyhton 前端01
文档结构: <!-- 定义文档类型 --> <!DOCTYPE html> <!-- 文档 --> <html lang='en'> <!-- 仅 ...
- day57 Pyhton 前端Jquery09
内容回顾: - 筛选选择器 $('li:eq(1)') 查找匹配的元素 $('li:first') $('li:last') - 属性选择器 - 筛选的方法 - find() 查找后代的元素 - ...
- day54 Pyhton 前端JS06
内容回顾 - ECMAScript5.0 基础语法 - var 声明变量 - 五种基本数据类型 - string - number NaN number 1 number - boolean - un ...
- day54 Pyhton 前端JS05
今日内容: 1.数组Array var colors = ['red','color','yellow']; 使用new 关键词对构造函数进行创建对象 var colors2 = new Array( ...
- day53 Pyhton 前端04
内容回顾: 盒子: 内边距:padding,解决内部矛盾,内边距的增加整个盒子也会增加 外边距:margin,解决外部矛盾,当来盒子都有外边距的时候,取两者最大值 边框:border border-c ...
- day52 Pyhton 前端03
内容回顾 块级标签: div p h 列表:ol;ul;dl 表格:table 行内标签: span a i/em b/strong u/del 行内块: input textarea img 其他: ...
- day51 Pyhton 前端02
内容回顾: 1.h1~h6:加粗,数字越大级别越小,自动换行 2.br:换行;hr:分割线; (特殊符号,空格) 3.p:与前边和后边内容之间有间距 4.a标签的href:本地文件连接;网络连接;锚链 ...
- 前端基础之jQuery(Day55)
阅读目录 一 jQuery是什么? 二 什么是jQuery对象? 三 寻找元素(选择器和筛选器) 四 操作元素(属性,css,文档处理) 扩展方法 (插件机制) 一. jQuery是什么? [1] ...
随机推荐
- 文件压缩跟解压(本地&Linux服务器)
远程解压需要的jar包: <dependency> <groupId>commons-net</groupId> <artifactId>commons ...
- JS基础回顾_函数
函数 不要使用C风格的大括号 // log function return1() { return { name: 'oceans', } } function return2() { return ...
- 复习 | 重温jQuery和Zepto的API
jq和zepto很相似有许多共同的api,zepto也出了很多与jq不一样的api,总的来说,两者更相似,但是zepto更轻量一点,正好公司也在用,复习这两个没错 jq中的zepto的事件和ajax我 ...
- Windows10数字权利永久激活教程
很多人用Windows10系统,但是没有办法激活,这个教程一定会让你永久激活windows10系统(并非ksm) 打开设置,查看是否激活 如果激活的话,先退掉秘钥,在Windows power ...
- 微服务实战系列(二)-注册中心Springcloud Eureka客户端
1. 场景描述 前几天介绍了下springcloud的Eureka注册中心(springcloud-注册中心快速构建),今天结合springboot-web介绍下eureka客户端服务注册. 2. 解 ...
- Kubernetes客户端和管理界面大集合
今天给大家介绍目前市面上常用的kubernetes管理工具,总有一款适合您~~~ 简介 Kubectl K9s Kubernetes-Dashboard Rancher Kuboard Lens Oc ...
- iOS14剪切板探究,淘宝实现方法分析
随着iOS 14的发布,剪切板的滥用也被大家所知晓.只要是APP读取剪切板内容,系统都会在顶部弹出提醒,而且这个提醒不能够关闭.这样,大家在使用APP的过程中就能够看到哪些APP使用了剪切板. 正好我 ...
- Ribbon源码分析(一)-- RestTemplate 以及自定义负载均衡算法
如果只是想看ribbon的自定义负载均衡配置,请查看: https://www.cnblogs.com/yangxiaohui227/p/13186004.html 注意: 1.RestTemplat ...
- Centos6.6x系统与unbutu18.04系统升级ssh到8.3版本
Centos6.6升级ssh5.3版本到ssh8.3版本 下载所需要的源码包: ]#wget https://files-cdn.cnblogs.com/files/luckjinyan/zlib-1 ...
- 给select赋值的一种方法
做毕设遇到的问题,在update数据的时候,要先把原来的数据传递给前台,赋值给input等标签,但是啊,select标签没有value属性啊,所以在这里研究了一下,总结一个给select赋值的方法吧 ...