首页 | 最近更改 | 编辑本页 | 较早版本

可打印版 | 免责声明

Not logged in
登录 | 帮助
 

Firefox:Dive Into Greasemonkey/4.19. Rewriting links

Mozilla中文Wiki

您的位置:Dive Into Greasemonkey公用模式4.19. 改写链接

4.19. 改写链接

如果您找到了页面上的一个链接,您可以通过设置它的 href 属性来改写链接。

Image:Permalink.gif 例子:在链接末尾添加查询参数

var a = document.getElementById('article');
if (a.href.match(/\?/i)) {
    // link already contains other parameters, so append "&printer=1"
    a.href += '&printer=1';
} else {
    // link does not contain any parameters, so append "?printer=1"
    a.href += '?printer=1';
}

实例


← 获取当前域名
重定向页面 →

取自"http://wiki.mozcn.org/index.php/Firefox:Dive_Into_Greasemonkey/4.19._Rewriting_links"

本页面已经被浏览1353次。 最后更改03:09 2005年11月20日. 本站内容在创作共用署名-非商业用途-保持一致条款下发布。


[首页]
首页
最近更改
随机页面
新闻动态

编辑本页
讨论本页
较早版本
链入页面
链出更改

特殊页面
错误报告