![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
js
ZhouMin8877
一心踏踏实实学,比什么都重要
展开
-
查找字符串 indexof 使用 ~ 符号
对每一个比特位执行非(NOT)操作。NOT a 结果为 a 的反转(即反码);即把0和1全部取反if (~str.indexOf(searchFor)){// searchFor 包含在字符串中}else{// searchFor 不包含在字符串中}转载 2020-06-28 10:13:26 · 554 阅读 · 0 评论 -
cookie获取不到浏览器中所有的cookie值的问题
如果浏览器中 cookie的,domain 不是当前环境的值,就无法用 document.cookie 拿到这个cookie原创 2019-06-18 16:35:24 · 8313 阅读 · 0 评论 -
js 开关设置遇到的问题
设置自定义属性的时候,如果设置的属性名称是 title ,或者其他的w3c内置属性,那么在js中获取到的值是字符串类型如果是其他的,比如onoff,获取到的是布尔类型...原创 2019-07-29 21:17:35 · 260 阅读 · 0 评论 -
js 模版字符串增加条件判断
用 三元判断或者自执行函数内使用if for ( let i = 0; i < data.length; i++ ) { const html = `<li class="fl t-left"><div class="target t-center"> <p>${data[...原创 2019-07-30 17:49:36 · 4167 阅读 · 1 评论 -
js获取计算后的css
function getCss(obj) { if (obj.currentStyle) { // 兼容ie return obj.currentStyle; } else { return getComputedStyle(obj) } }原创 2019-09-26 11:46:35 · 269 阅读 · 0 评论