这样写试一下
FR.Msg.advancedPrompt("输入", "请输入您的爱好:", "", { type: 'password' }, function(result)

--------------------------------------------------------------------------
const password = () => {
let i = 0; // 尝试次数计数器
let passwd; // 存储密码
function showPasswordDialog(remainingAttempts) {
// 创建密码输入弹窗
const dialog = document.createElement('div');
dialog.style.cssText = `
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: white;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0,0,0,0.2);
z-index: 9999;
`;
// 创建密码输入框(type="password"会显示为***)
const input = document.createElement('input');
input.type = 'password'; // 关键修改:设置为密码类型
input.placeholder = '请输入密码';
input.style.cssText = `
padding: 8px;
margin: 10px 0;
width: 200px;
display: block;
`;
// 提示信息
const message = document.createElement('p');
message.textContent = `您还有 ${remainingAttempts} 次尝试机会`;
message.style.color = 'red';
// 创建按钮容器
const buttonContainer = document.createElement('div');
buttonContainer.style.textAlign = 'right';
buttonContainer.style.marginTop = '10px';
// 确定按钮
const confirmBtn = document.createElement('button');
confirmBtn.textContent = '确定';
confirmBtn.onclick = () => {
const inputValue = input.value;
if (!inputValue) {
alert('密码不能为空!');
return;
}
processPassword(inputValue);
document.body.removeChild(dialog);
};
// 取消按钮
const cancelBtn = document.createElement('button');
cancelBtn.textContent = '取消';
cancelBtn.style.marginLeft = '10px';
cancelBtn.onclick = () => {
document.body.removeChild(dialog);
// 取消操作后的处理
alert('连续密码错误,即将跳转至其他页面');
location.href = "http://10.83.1.251:8080/";
};
// 组装元素
dialog.appendChild(document.createTextNode('请输入密码:'));
dialog.appendChild(document.createElement('br'));
dialog.appendChild(input);
dialog.appendChild(message);
buttonContainer.appendChild(confirmBtn);
buttonContainer.appendChild(cancelBtn);
dialog.appendChild(buttonContainer);
// 添加到DOM
document.body.appendChild(dialog);
// 自动聚焦到输入框
input.focus();
}
function processPassword(inputValue) {
if (inputValue === "--+") { // 假设密码是123
// 密码正确
return;
}
i++;
if (i < 3) {
alert("密码错误!请重新输入:\n你还有" + (3 - i) + "次机会。");
showPasswordDialog(3 - i);
} else {
alert("连续密码错误,即将跳转至其他页面");
location.href = "http://10.83.1.251:8080/";
}
}
// 启动密码验证流程
showPasswordDialog(3);
};
password();