返回顶部

收藏

javascript 检测<input> 或 <textarea> 是否获得焦点

更多
window.onload = function() {
    for (i=0; i<form.elements.length-1; i++) {
        elem = document.forms['quick_reply'].elements[i];
        elem.focused = false;
        elem.hasFocus = function() {
            return this.focused;
        };
        elem.onfocus=function() {
            this.focused=true;
        };
        elem.onblur=function() {
            this.focused=false;
        };
    }
    }

标签:javascript,javascript

收藏

0人收藏

支持

0

反对

0