var Page_INIT = function () {
$(document). bind("mouseover", function (e) {//mouse moves into
if (e.target.tagName.toUpperCase() == "INPUT") {
var input = e.target;
if (input.type == "text") {//If it is a text box
if (window.Page_FocusTimer) {//If it is in the focus state
window.clearTimeout(window.Page_FocusTimer);//Clear the focus state
}
window.Page_FocusTimer = window.setTimeout(function () { //Execute this anonymous method every 0.2 milliseconds
if (!input.value) {//If the content is empty , then set as focus
try {
input.focus();
} catch (e) { }
}
}, 200);
}
}
}).bind("mouseout", function (e) {//Mouse out
if (e.target.tagName.toUpperCase() == "INPUT") { //The event source object being processed If the name (i.e. HTML tag) is converted to uppercase, it will be INPUT
var input = e.target;
if (input.type == "text") {
if (window.Page_FocusTimer) {
window.clearTimeout(window.Page_FocusTimer);
}
}
}
});
}
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn