var btn = document.getElementById('btn');
var div = document.getElementById('div');
btn.onclick = function(ev){
var oEvent = ev||event;
oEvent.cancelBubble = true; //阻止继续向 document 冒泡
div.style.display = 'block';
}
document.onclick = function(){
div.style.display = 'none';
}