Firefox:Dive Into Greasemonkey/4.7. Inserting content before an element
Mozilla中文Wiki
您的位置:Dive Into Greasemonkey → 公用模式 → 在元素前插入新内容
[编辑]
4.7. 在元素前插入新内容
如果您已经获取了某个元素(不论用何种方法),您想在它之前加入额外的内容。这时,您可以通过 insertBefore 函数来完成这个操作。
例子: 在 ID="main" 的元素(假设这个元素存在)前加<hr>
var main, newElement;
main = document.getElementById('main');
if (main) {
newElement = document.createElement('hr');
main.parentNode.insertBefore(newElement, main);
}
[编辑]
实例
- Butler (http://diveintomark.org/projects/butler/butler.user.js)
- ZoomTextarea (http://diveintogreasemonkey.org/download/zoomtextarea.user.js)
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)