欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

基于jquery實現(xiàn)的移入頁面上空文本框時,讓它變?yōu)榻裹c,移出清除焦點

 更新時間:2011年07月26日 20:19:45   作者:  
基于jquery實現(xiàn)的移入頁面上空文本框時,讓它變?yōu)榻裹c,移出清除焦點的實現(xiàn)代碼。
復制代碼 代碼如下:

var Page_INIT = function () {
$(document).bind("mouseover", function (e) {//鼠標移入
if (e.target.tagName.toUpperCase() == "INPUT") {
var input = e.target;
if (input.type == "text") {//如果是文本框
if (window.Page_FocusTimer) {//如果處于焦點狀態(tài)
window.clearTimeout(window.Page_FocusTimer);//清除焦點狀態(tài)
}
window.Page_FocusTimer = window.setTimeout(function () { //每0.2豪秒去執(zhí)行這個匿名方法一次
if (!input.value) {//如果內容為空,則設為焦點
try {
input.focus();
} catch (e) { }
}
}, 200);
}
}
}).bind("mouseout", function (e) {//鼠標移出
if (e.target.tagName.toUpperCase() == "INPUT") { //被處理的事件源對象它的名稱(即HTML標記)轉為大寫后如果是INPUT
var input = e.target;
if (input.type == "text") {
if (window.Page_FocusTimer) {
window.clearTimeout(window.Page_FocusTimer);
}
}
}
});
}

相關文章

最新評論