点击其他区域 阻止input框发失去焦点事件

//点击关闭按钮 input框不触发失去焦点事件
document.getElementById('js_close').onmousedown=function(e){
    if ( e && e.preventDefault ){
        e.preventDefault();
    }else{
        window.event.returnValue = false;
    }
    return false;
  
  };

preventDefault() 方法阻止元素发生默认的行为(例如,当点击提交按钮时阻止对表单的提交)。

window.event.returnValue=false//IE

原文地址:https://www.cnblogs.com/qiu2841/p/10856434.html