我创建了一个脚本,它在悬停时显示密码,就像 Windows 8 在眼睛点击时一样。
我使用以下代码通过 JavaScript 实现了此功能。
function text(){this.type="text"}function password(){this.type="password"}function addHandlers(){var e=false;var t=document.evaluate("//input[@type='password']",document,null,6,null);for(var n=t.snapshotLength-1,r;r=t.snapshotItem(n);n--){if(!e){r.addEventListener("mouseover",text,false);r.addEventListener("mouseout",password,false)}else{r.addEventListener("focus",text,false);r.addEventListener("blur",password,false)}}}addHandlers()
Run Code Online (Sandbox Code Playgroud)
抱歉打包的 JavaScript 代码,但我想创建一个运行此脚本的书签或书签...
我试过:
javascript:(mycode);
Run Code Online (Sandbox Code Playgroud)
但它没有用...