一些常用知识点
<script src="jquery-2.0.3.min.js"></script> 导入jq库PHP explode 切割字符串 js for forin php的数组不能直接js调用,要先json_encode()转成json, 再eval转成数组 php数组存的时候 arr[]=xxxx
引入外部css placeholder="请输入..." 输入框第一次显示 请输入。。 .val 取$.ajax({ type: 'POST', url: '/investigate/writedata', data: {data:data,id:}, dataType: 'json', success: function(data){ if(data.status == 'success'){ alert(data.msg); }else{ alert(data.msg); } } });
box-shadow:[inset] x-offset y-offset blur-radius spread-radiuscolor 阴影( 有上下左右阴影 )box-shadow: 上,右 ,下 ,左 textarea 文本框多行 input输入框单行 placeholder=“请输入。。。” window.prompt()确认框
对于HTML元素本身就带有的固有属性,在处理时,使用prop方法。 对于HTML元素我们自己自定义的DOM属性,在处理时,使用attr方法。 INT((ACOS(SIN(B1/180PI())SIN(B2/180PI())+COS(B1/180PI())COS(B2/180PI())COS(A1/180PI()-A2/180*PI()))18060/PI())
100000)/1000001.852 两经纬度之间距离 object.prototype.name=value prototype 属性使您有能力向对象添加属性和方法。
取消事件的默认动作。 禁止缩放 /data/www/admin/protected/config 添加分类的表/一行表示*/ overflow: hidden; white-space: nowrap; text-overflow: ellipsis; /*2行表示/ display: -webkit-box; overflow: hidden; text-overflow: ellipsis; word-wrap: break-word; white-space: normal !important; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
-webkit-box-sizing:border-box;内边框
WeixinJSBridge.invoke('closeWindow',{},function(res){ alert(res.err_msg); alert('关闭本页面!'); });
//判断手机号 function isPhone(phone){ var myreg = /^(((13[0-9]{1})|(14[0-9]{1})|(17[0]{1})|(15[0-3]{1})|(15[5-9]{1})|(18[0-9]{1}))+\d{8})$/; if(phone == ''){ // message = "手机号码不能为空!"; return false; }else if(phone.length !=11){ // message = "请输入有效的手机号码!"; return false; }else if(!myreg.test(phone)){ // message = "请输入有效的手机号码!"; return false; }else{ return true; } }
//判断身份证
function isCardID(sId){
var aCity={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:"国外"} var iSum=0 ; var info="" ; //你输入的身份证长度或格式错误 if(!/^\d{17}(\d|x)$/i.test(sId)) return false; sId=sId.replace(/x$/i,"a"); //你的身份证地区非法 if(aCity[parseInt(sId.substr(0,2))]==null) return false; sBirthday=sId.substr(6,4)+"-"+Number(sId.substr(10,2))+"-"+Number(sId.substr(12,2)); var d=new Date(sBirthday.replace(/-/g,"/")) ; //"身份证上的出生日期非法" if(sBirthday!=(d.getFullYear()+"-"+ (d.getMonth()+1) + "-" + d.getDate()))return false; for(var i = 17;i>=0;i --) iSum += (Math.pow(2,i) % 11) * parseInt(sId.charAt(17 - i),11) ; //"你输入的身份证号非法" if(iSum%11!=1) return false; //aCity[parseInt(sId.substr(0,2))]+","+sBirthday+","+(sId.substr(16,1)%2?"男":"女");//此次还可以判
断出输入的身份证号的人性别 return true; }
<textarea type="text" name="helpInfo" placeholder="请输入..."> resize: none;固定大小 /^\d+$/ //非负整数(正整数 + 0)
/^[0-9][1-9][0-9]
echo "<script> addHtml('{$item["nickname"]}','{$item["reply"]}','{$k}','{$item["review"]}','{$item["nickname"]}');
</script>";在php中加js,以及拼接php 用.!!!!
<iframe frameborder=0 name="back" style="width:100%;min-height:100%;"></iframe>点击之后同一页显示数据explode("",string) 切割字符串变成数组
history.back(-1):直接返回当前页的上一页,数据全部消息,是个新页面
history.go(-1):也是返回当前页的上一页,不过表单里的数据全部还在
/* background:-webkit-linear-gradient(top,#99b5dc,#fff); */
box-sizing: border-box;内边框
<script src="jquery-2.0.3.min.js"></script> http://bhjiguan.wxshidai.com'; }else{ window.history.go(-1); return false; } }input file里面 accept="image/;capture=camera" 直接调用相机 accept="image/" 调用相机 图片或者相册
//dirname() 函数返回路径中的目录部分。 require_once(dirname(FILE).'/xx.php'); //页面上不能复制的用这个 javascript:document.body.contentEditable='true';document.designMode='on'; void(0);
移动端web禁用长按选中功能 方案一
- { -webkit-user-select:none; -moz-user-select:none; -ms-user-select:none; user-select:none; } 问题一:这样会让iOS的input框无法聚焦
解决方案: input{-webkit-user-select:auto;} 问题二:如果需要长按发送语音,禁用长按之后,无法长按发送语音
解决方案:
方法二: 禁用点击事件 div { pointer-events: none;} 方法三: 禁用系统默认事件。后期的CLICK不能用了 window.ontouchstart = function(e) { e.preventDefault(); };
:root { --line-height: 20; } p { line-height: var(--line-height)px; } root里面写默认的数据可以复用
// 计算加载时间
function getPerformanceTiming() {
var performance = window.performance;
if (!performance) {
// 当前浏览器不支持
console.log('你的浏览器不支持 performance 接口');
return;
}
var t = performance.timing;
var times = {};
//【重要】页面加载完成的时间
//【原因】这几乎代表了用户等待页面可用的时间
times.loadPage = t.loadEventEnd - t.navigationStart;
//【重要】解析 DOM 树结构的时间
//【原因】反省下你的 DOM 树嵌套是不是太多了!
times.domReady = t.domComplete - t.responseEnd;
//【重要】重定向的时间
//【原因】拒绝重定向!比如,http://example.com/ 就不该写成 http://example.com
times.redirect = t.redirectEnd - t.redirectStart;
//【重要】DNS 查询时间
//【原因】DNS 预加载做了么?页面内是不是使用了太多不同的域名导致域名查询的时间太长?
// 可使用 HTML5 Prefetch 预查询 DNS ,见:HTML5 prefetch
times.lookupDomain = t.domainLookupEnd - t.domainLookupStart;
//【重要】读取页面第一个字节的时间
//【原因】这可以理解为用户拿到你的资源占用的时间,加异地机房了么,加CDN 处理了么?加带宽了么?加 CPU 运算速度了么?
// TTFB 即 Time To First Byte 的意思
// 维基百科:https://en.wikipedia.org/wiki/Time_To_First_Byte
times.ttfb = t.responseStart - t.navigationStart;
//【重要】内容加载完成的时间
//【原因】页面内容经过 gzip 压缩了么,静态资源 css/js 等压缩了么?
times.request = t.responseEnd - t.requestStart;
//【重要】执行 onload 回调函数的时间
//【原因】是否太多不必要的操作都放到 onload 回调函数里执行了,考虑过延迟加载、按需加载的策略么?
times.loadEvent = t.loadEventEnd - t.loadEventStart;
// DNS 缓存时间
times.appcache = t.domainLookupStart - t.fetchStart;
// 卸载页面的时间
times.unloadEvent = t.unloadEventEnd - t.unloadEventStart;
// TCP 建立连接完成握手的时间
times.connect = t.connectEnd - t.connectStart;
return times;
}