![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
js
u010978477
这个作者很懒,什么都没留下…
展开
-
js阻止默认行为
摘要: js默认行为阻止一.哪些默认行为要做阻止1.a标签链接跳转什么是默认行为?一个最简单的例子,我有一个a标签:a href="https://www.baidu.com/" target="_blank">百度a>我们预览打开,点击百度两个字就会打开百度页面,点击后链接地址跳转就是a标签的默认行为。我们有没有办法在a点击后让他不跳转的处理呢?这是肯定有的,转载 2017-09-14 22:51:41 · 12020 阅读 · 1 评论 -
浅谈 Mousewheel 事件
当需要制作转动鼠标滚轮放大页面字体这样的交互效果时,会用到 Mousewheel 事件。 其实在大多数浏览器(IE6, IE7, IE8, Opera 10+, Safari 5+)中,都提供了 “mousewheel” 事件。但杯具的是 Firefox 3.5+ 却不支持此事件,不过庆幸 Firefox 3.5+ 中提供了另外一个等同的事件:”DOMMouseScroll”...转载 2018-04-28 14:18:28 · 20469 阅读 · 0 评论 -
阻止事件冒泡
if(event.stopPropagation){ event.stopPropagation(); //for Mozilla and Opera}else if(window.event){ window.event.cancelBubble = true; //for IE}原创 2018-04-28 14:23:46 · 264 阅读 · 0 评论 -
页面静止一定时间没有操作跳转页面
var currentUrl = window.location.href; //获取当前页面地址 var timefly = 5000; //超时时间 var beginDt = new Date(); //把得到的当前时间放入变量作为初始时间 var gourl = "http://baidu.com"; ...原创 2018-07-30 10:59:10 · 2167 阅读 · 0 评论 -
获取网页地址后面的参数
$.getUrlParam = function (page) {var reg = new RegExp("(^|&)" + page + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象var r = window.location.search.substr(1).match(reg); //匹配目标参数if (r != nul...原创 2019-06-21 15:45:04 · 1311 阅读 · 0 评论 -
js如何截取网页地址
1,设置或获取对象指定的文件名或路径。alert(window.location.pathname)2,设置或获取整个 URL 为字符串。alert(window.location.href);3,设置或获取与 URL 关联的端口号码。alert(window.location.port)4,设置或获取 URL 的协议部分。alert(window.location.p...原创 2019-06-21 15:52:59 · 2352 阅读 · 0 评论