JavaScript用户脚本不会自行运行

时间:2013-07-05 14:59:18

标签: javascript greasemonkey

我正在使用Greasemonkey而我正在尝试编写自己的用户脚本。 我已经有了代码,但它并没有“运行”,不知道为什么。

// ==UserScript==
// @name       Image link
// @version    0.1
// @include      http://*.*
// @run-at      document-end
// ==/UserScript==
var img = document.getElementById('image'),
style = img.currentStyle || window.getComputedStyle(img, false),
link = style.backgroundImage.slice(4, -1);
alert(link);

我能做些什么来让它真正起作用?

1 个答案:

答案 0 :(得分:0)

代码很好,但网站坏了。它适用于另一个。