JavaScript
青崖林夕
脚踏实地,仰望星空!
展开
-
js怎样判断图片链接是否有效
1. 仅验证一张图片链接:function checkImgExists(imgurl) { return new Promise(function(resolve, reject) { var ImgObj = new Image(); ImgObj.src = imgurl; ImgObj.onload = function(res) { resolve(res); } ImgObj.onerror = func.原创 2021-07-28 11:53:04 · 3261 阅读 · 1 评论 -
JS 手机号中间4位变星号
一:正则方法varstr1='13991367972'varreg=/^(\d{3})\d*(\d{4})$/;varstr2=str1.replace(reg,'$1****$2')二:字符串方法var str='1366668888';var str2 = str.substr(0,3)+"****"+str.substr(7);...原创 2019-11-23 20:43:05 · 1546 阅读 · 0 评论