
function showAlert() {
// 显示警告框
alert("先选择会计科目,再进行查询");
// 设置一个3秒的定时器
setTimeout(function() {
// 使用定时器关闭警告框
var alertBox = document.querySelector(".alert-box");
if (alertBox) {
alertBox.style.display = "none";
}
}, 3000);
}
// 创建自定义警告框
function createCustomAlert() {
var alertBox = document.createElement("div");
alertBox.className = "alert-box";
alertBox.innerText = "先选择会计科目,再进行查询";
alertBox.style.position = "fixed";
alertBox.style.top = "50%";
alertBox.style.left = "50%";
alertBox.style.transform = "translate(-50%, -50%)";
alertBox.style.padding = "20px";
alertBox.style.backgroundColor = "#f44336";
alertBox.style.color = "#fff";
alertBox.style.zIndex = "1000";
document.body.appendChild(alertBox);
// 设置一个3秒的定时器
setTimeout(function() {
alertBox.style.display = "none";
}, 3000);
}
// 调用自定义警告框
createCustomAlert();