Firefox:Dive Into Greasemonkey/4.21. Intercepting user clicks
Mozilla中文Wiki
您的位置:Dive Into Greasemonkey → 公用模式 → 截取用户鼠标点击
[编辑]
4.21. 截取用户鼠标点击
虽然改写链接很简单,您也可以一步登天。使用 addEventListener 函数,俘获页面上任何地方的每次点击。(这也俘获了链接的点击。)您能够计算应该去做什么:是否允许可点击元素的点击操作“失效”,或者做些完全不同的操作。
document.addEventListener('click', function(event) {
// event.target is the element that was clicked
// do whatever you want here
// if you want to prevent the default click action
// (such as following a link), use these two commands:
event.stopPropagation();
event.preventDefault();
}, true);
注意这里使用了一个匿名函数,将一个参数传递给 document.addEventListener 函数。
← 重定向页面
Strict Standards: Non-static method Namespace::getUser() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 510
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1450
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Notice: Only variable references should be returned by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Namespace.php on line 138
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Notice: Only variable references should be returned by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Namespace.php on line 138
Strict Standards: Only variables should be passed by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Non-static method Namespace::isTalk() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1367
Strict Standards: Non-static method Namespace::getTalk() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1387
Strict Standards: Non-static method Namespace::isTalk() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Namespace.php on line 99
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1437
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1439
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Strict Standards: Only variables should be passed by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1439
Strict Standards: Non-static method Namespace::getImage() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1505
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1450
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Notice: Only variable references should be returned by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Namespace.php on line 138
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Notice: Only variable references should be returned by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Namespace.php on line 138
Strict Standards: Only variables should be passed by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Non-static method Namespace::getSpecial() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/languages/Language.php on line 1456
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1450
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Strict Standards: Only variables should be passed by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Non-static method Namespace::getSpecial() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/languages/Language.php on line 1456
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1450
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Strict Standards: Only variables should be passed by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Non-static method Namespace::getUser() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 775
Strict Standards: Non-static method Namespace::getTalk() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 776
Strict Standards: Non-static method Namespace::getUser() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 776
Strict Standards: Non-static method Namespace::isTalk() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Namespace.php on line 99
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1450
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Only variables should be passed by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1450
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Notice: Only variable references should be returned by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Namespace.php on line 138
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Notice: Only variable references should be returned by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Namespace.php on line 138
Strict Standards: Only variables should be passed by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Non-static method Namespace::getSpecial() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/languages/Language.php on line 1456
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1450
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Strict Standards: Only variables should be passed by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Non-static method Title::makeTitle() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 718
Strict Standards: Non-static method Title::makeName() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 138
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Strict Standards: Only variables should be assigned by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 718
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 900
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1450
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Only variables should be passed by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Non-static method Namespace::getSpecial() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/languages/Language.php on line 1456
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1450
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Strict Standards: Only variables should be passed by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Non-static method Namespace::getSpecial() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/languages/Language.php on line 1456
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1450
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Strict Standards: Only variables should be passed by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1450
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Only variables should be passed by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Non-static method Namespace::getUser() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 510
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1450
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Notice: Only variable references should be returned by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Namespace.php on line 138
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Notice: Only variable references should be returned by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Namespace.php on line 138
Strict Standards: Only variables should be passed by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Non-static method Namespace::isTalk() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1367
Strict Standards: Non-static method Namespace::getTalk() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1387
Strict Standards: Non-static method Namespace::isTalk() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Namespace.php on line 99
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1437
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1439
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Strict Standards: Only variables should be passed by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1439
Strict Standards: Non-static method Namespace::getImage() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1505
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1450
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Notice: Only variable references should be returned by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Namespace.php on line 138
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Notice: Only variable references should be returned by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Namespace.php on line 138
Strict Standards: Only variables should be passed by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Non-static method Namespace::getSpecial() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/languages/Language.php on line 1456
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1450
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Strict Standards: Only variables should be passed by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Non-static method Namespace::getSpecial() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/languages/Language.php on line 1456
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1450
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Strict Standards: Only variables should be passed by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Non-static method Namespace::getUser() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1023
Strict Standards: Non-static method Namespace::getTalk() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1024
Strict Standards: Non-static method Namespace::getUser() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1024
Strict Standards: Non-static method Namespace::isTalk() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Namespace.php on line 99
Strict Standards: Non-static method Namespace::getSpecial() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/languages/Language.php on line 1456
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1450
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Strict Standards: Only variables should be passed by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1450
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Notice: Only variable references should be returned by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Namespace.php on line 138
Strict Standards: Non-static method Title::newFromText() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452
Strict Standards: Non-static method Namespace::getCanonicalIndex() should not be called statically, assuming $this from incompatible context in /home/mozcn/html/mediawiki-1.3.18/includes/Title.php on line 695
Notice: Only variable references should be returned by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Namespace.php on line 138
Strict Standards: Only variables should be passed by reference in /home/mozcn/html/mediawiki-1.3.18/includes/Skin.php on line 1452

![[首页]](/stylesheets/images/wiki.png)