求助大佬,自动填充账号问题
#[网站](https://web.moycp.com/login)通过 js 方法赋值以后点击,登录值会消失
![图片.png](data/attachment/forum/202208/25/234735zc8c7p9cw6oiop73.png) [油猴脚本开发指南]元素规则校验和检测的触发
https://bbs.tampermonkey.net.cn/thread-1250-1-1.html
提问之前建议先查阅开发指南哦 //自动登录
function login() {
console.log("登录ing");
let object = $(".choosed")
if (object == null) {
$(".free-login").click();
}else {
console.log("已经勾选")
}
$(":text").attr("autocomplete","off");
$(":password").attr("autocomplete","new-password");
var focus = new Event('focus');
var input= new Event('input');
var change= new Event('change');
var blur= new Event('blur');
let username = document.getElementsByClassName("username");
username.value = setting.username;
username.dispatchEvent(focus);
username.dispatchEvent(input);
username.dispatchEvent(change);
username.dispatchEvent(blur);
let password =document.getElementsByClassName("password");
password.value= setting.password;
password.dispatchEvent(focus);
password.dispatchEvent(input);
password.dispatchEvent(change);
password.dispatchEvent(blur);
//七天自动登录
if (setting.isLogin) {
$(".el-button.login-btn").click();
setting.isLogin = false
}
}
页:
[1]