![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
JQUERY
kangsf1989
这个作者很懒,什么都没留下…
展开
-
JS数组去重
function unique(arr){ for(var i=0; i<arr.length; i++){ for(var j=i+1; j<arr.length; j++){ if(arr[i]==arr[j]){ //第一个等同于第二个,splice方法删除第二个 arr.splice(j,1); j--; } .原创 2021-09-22 16:22:46 · 94 阅读 · 0 评论 -
图片懒加载
html:<img src="/images/nullspecail.jpg" data-title="测试" data-src="http://kangsf1989.net/120-147-b.jpg"alt="">js:<script> var imgs = document.querySelectorAll('img'); functi原创 2018-11-05 08:44:10 · 138 阅读 · 0 评论 -
js 判断 https 还是http
function getBaseUrl() { var ishttps = 'https:' == document.location.protocol ? true : false; var url = window.location.host; if (ishttps) { url = 'https://' + url; } e...原创 2018-11-15 10:42:55 · 4785 阅读 · 0 评论 -
php正则匹配A标签href并替换
$file = "<a href="http://www.baidu.com">baidu</a>";$file = preg_replace('/<a .*?href="(.*?)".*?>/is',"<a href='###'>",$file);//输出结果<a href="###原创 2018-11-27 12:01:52 · 5369 阅读 · 1 评论 -
鼠标单击随机出现文字特效
<script type="text/javascript"> /* 鼠标特效 */ var a_idx = 0; jQuery(document).ready(function ($) { $("body").click(function (e) { var a = [ "耍流氓", ...原创 2018-12-14 10:44:59 · 1160 阅读 · 0 评论 -
前端原生AJAX封装
function ajax(options){ options=options||{}; options.data=options.data||{}; options.type=options.type||'get'; options.timeout=options.timeout||0; options.data.t=Math.random();...原创 2019-01-08 15:06:33 · 194 阅读 · 0 评论