一、children()
1、描述:获取当前jq对象的子节点
2、语法:jq对象.children()
3、PS:
①当children()不写参数的时候 获取的是所有的孩子
②当children('孩子的选择器') 获取的是指定的孩子
③children() 只能选择 直接孩子 不能选择 孙子元素
4、eg:
$('button:first').click(function () { //选择指定的孩子 $('.box').children('.s1').css('background-color','red'); //选择所有的孩子 $('.box').children().css('background-color','red'); })
二、find()
1、描述:获取指定的孩子
2、语法:jq对象.find('孩子的选择器')
3、PS:
①不能空参使用,不能获取所有的孩子
②只要是孩子元素,就能使用find()
4、eg:
$('button:first').click(function () { console.log('666'); $('.box').find('.s2').css('backgroundColor','red'); });
三、parent()/parents()
1、描述:查找当前jq对象的父节点/所有的父节点直到祖先节点
2、语法:jq对象.parent()/parents()
3、eg:
$('button:first').click(function () { //$('.p0').parent().css('background-color','red'); $('.p0').parents().css('background-color','red'); });
四、siblings()
1、描述:获取所有的兄弟节点
2、语法:jq对象.siblings(选择器)
3、PS:
①不写参数,获取的是所有的兄弟
②写参数,获取的是满足选择器要求的兄弟
4、eg:
$('button:first').click(function () { $('.p0').siblings('.p1').css('background-color', 'red'); }); $('p').click(function () { $(this).html('很开心').siblings().html('很开心').parent().siblings().children().html('不开心'); });
五、next()
1、描述:获取下一个兄弟节点
2、语法:jq对象.next()
3、eg:
$('p').click(function () { $(this).next().css('background-color','red'); })
六、nextAll()
1、描述:获取后面所有的兄弟节点
2、语法:jq对象.nextAll()
3、eg:
$('p').click(function () { $(this).nextAll().css('background-color', 'red'); });
七、prev()
1、描述:获取当前节点的前一个兄弟节点
2、语法:jq对象.prev()
3、eg:
$('p').click(function () { $(this).prev().css('background-color', 'red'); });
八、prevAll()
1、描述:获取当前节点前面的所有兄弟节点
2、语法:jq对象.prevAll()
3、eg:
$('p').click(function () { $(this).prevAll().css('background-color', 'red'); });
if($(":input[name=piclist]").length <= 0){ return false; }
if (!$(":radio[name=sex]").is(":checked")){ alert("请选择性别"); $("#sex").focus(); return false; }
function ISmobile(str){ var p=/^1[3|4|5|6|7|8][0-9]\d{7,8}$/; if(str.match(p)!=null) { return true; } return false; } function IScard(str){ var p=/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/; if(str.match(p)!=null) { return true; } return false; }
<script type="text/javascript"> //给身份证文本框添加一个失去焦点事件: $("#idNumber").blur(function() { //获取身份证号码,例如:412702199301010000,这里不再判断身份证号是否合法 var idNumber = $("#idNumber").val(); //定义籍贯、出生日期、性别、年龄等变量 var provinces,province,birthday,currDate,month,date,age,sex; //一、获取籍贯,由于数据量比较大,所以这里只获取到省: //定义地区数组 provinces = { 11: "北京", 12: "天津", 13: "河北", 14: "山西", 15: "内蒙古", 21: "辽宁", 22: "吉林", 23: "黑龙江", 31: "上海", 32: "江苏", 33: "浙江", 34: "安徽", 35: "福建", 36: "江西", 37: "山东", 41: "河南", 42: "湖北", 43: "湖南", 44: "广东", 45: "广西", 46: "海南", 50: "重庆", 51: "四川", 52: "贵州", 53: "云南", 54: "西藏", 61: "陕西", 62: "甘肃", 63: "青海", 64: "宁夏", 65: "新疆", 71: "台湾", 81: "香港", 82: "澳门", 91: "国外" }; province = provinces[parseInt(idNumber.substr(0, 2))]; //二、出生日期 birthday = idNumber.substring(6, 10) + "-" + idNumber.substring(10, 12) + "-" + idNumber.substring(12, 14); //三、计算年龄 currDate = new Date(); month = currDate.getMonth() + 1; date = currDate.getDate(); age = currDate.getFullYear() - idNumber.substring(6, 10) - 1; //判断年龄 if (idNumber.substring(10, 12) < month || (idNumber.substring(10, 12) == month && idNumber.substring(12, 14) <= date)) { age++; } //四、获取性别 if (parseInt(idNumber.substr(16, 1)) % 2 == 1) { //男 sex = "man"; } else { //女 sex = "woman"; } //赋值 $("#province").val(province); $("#birthday").val(birthday); $("#age").val(age); $("input[name='sex'][type=radio][value='" + sex + "']").attr("checked", true); }); </script>
网易云接口
http://ip.ws.126.net/ipquery?ip=[IP地址]
搜狐接口
http://pv.sohu.com/cityjson?ie=utf-8
爱奇艺接口
http://ip.geo.iqiyi.com/cityjson?format=json&ip=[IP地址]
ip-api
http://ip-api.com/json/[IP地址]?lang=zh-CN
太平洋电脑网接口
http://whois.pconline.com.cn/ipJson.jsp?ip=[IP地址]&json=true
腾讯接口
https://apis.map.qq.com/ws/location/v1/ip?output=jsonp&key=KUQBZ-FYDCU-YMVVN-2DDW5-7WDYE-5JBJR&ip=[IP地址]&callback=jQuery18301852690032249129_1600324416562&_=1600324417180
ip.cn
https://www.ip.cn/api/index?ip=&type=0
bilibili
https://api.bilibili.com/x/web-interface/zone
speedtest
https://forge.speedtest.cn/api/location/info
flex-direction
row:默认值,主轴为水平方向,起点在左端
row-reverse:主轴为水平方向,起点在有段
column:主轴为垂直方向,起点在上方
column-reverse:主轴为垂直方向,起点在下方
flex-wrap
wrap:换行,第一行在上方
wrap-reverse:换行,第一行在下方
justify-content
flex-start:默认值左对齐
flex-end:右对齐
center:居中
space-between:两端对齐,项目之间的间隔都相等
space-around:每个项目两侧的间隔相等。
align-items
flex-start:交叉轴的起点对齐
flex-end:价差周的终点对齐
center:交叉轴的中点对齐
baseline:项目的第一行文字的基线对齐
stretch:默认值,如果项目未设置豪赌或者auto,将占满整个容器的高度
align-content
flex-start:与交叉轴的起点对齐
flex-end:与交叉轴的终点对齐
center:与交叉轴的中点对齐
space-between:与检查周两端对齐,轴线之间的间隔平均分布
space-around:没跟轴线两侧的间隔都相等。
strech:默认值轴线占满整个交叉轴
一、标准说法
标准是首字母大写的,X-Your-Custom-Header
不区分大小写
二、微信小程序中
如以下文件上传的请求,Header 中 定义了 accessKey 参数。
wx.uploadFile({
url: url,
filePath: path,
header: {
accessKey : "123456"
},
name: '',
success: function (resu) {
console.log(resu);
},
fail: function (err) {
console.log(err);
}
})
这个 Header 中的 accessKey 在开发环境是不会做改变的,服务器接收到的还是 accessKey,但是在真机环境下就不一样的,会变成 accesskey,全部小写了。当使用 actionContext.Request.Headers 的 Key = 来取时,问题就来了。
使用 HttpContext.Current.Request["accessKey"] 则没问题,应该是它大小写无关的原因。
<!--test.wxml-->
<button style="margin-top:50px;" bindtap="getQRCode">扫一扫</button>
<view>{{ qRCodeMsg }}</view>
//test.js Page({ data:{ qRCodeMsg:'' }, getQRCode: function(){ var _this = this; wx.scanCode({ //扫描API success: function(res){ console.log(res); //输出回调信息 _this.setData({ qRCodeMsg: res.result }); wx.showToast({ title: '成功', duration: 2000 }) } }) } })
<p>hello</p>
$("p").append("<b>world</b>")使用append插入
<p>hello<b>world</b></p>//显示结果
$("p").prepend("<b>world</b>")//使用prepend插入
<p><b>world</b>hello</p>//显示结果
$("p").after("<b>world</b>")//使用after插入语句
<p>hello</p><b>world</b>//显示结果
$("p").before("<b>world</b>")//使用before插入语句
<b>world</b><p>hello</p>//显示结果