在我的greasemonkey脚本中,我想检查GM值:用户名和密码是否已设置,但是当我尝试以下代码时,它会返回错误:
TypeError: GM_getValue(...) is undefined
...f (GM_getValue ("username").length == 0 + GM_getValue ("password").length == 0 )
代码:
if (GM_getValue ("username").length == 0 + GM_getValue ("password").length == 0 ){
var username = $('input[name=username]');
var password = $('input[name=password]');
//Username en Password in Firefox zetten met GM_setValue
$(".button").click(function(){
GM_setValue ("username", username.val() );
GM_setValue ("password", password.val() );
});
}