1 function hideBox(event,obj) { 2 var event = event || window.event; 3 var oBox = obj; 4 var oTarget = event.relatedTarget || event.toElement; 5 if (contains(oBox, oTarget)) { 6 return; 7 } else { 8 obj.style.display = "none"; 9 } 10 } 11 12 function contains(refNode, otherNode) { 13 if (typeof refNode.contains == "function" || "object") { 14 return refNode.contains(otherNode); 15 } else { 16 return !!(refNode.compareDocumentPosition(otherNode) & 16); 17 } 18 }
1 <div id="hidediv" onmouseout="hideBox(event,this);" ></div>