就是点空白的地方让div消失, ff下不可以 为什么了..........<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head><body>
<div id='div' style=" height:300px; width:300px; background:#FF6600; display:none" onblur="hide()"></div>
<input value="queding" type="button"  onclick="show()" />
<script>
var div = null;
window.onload =function(){div = document.getElementById("div")};
function show(){
div.style.display = "";
div.focus();
}function hide(){
div.style.display = "none";
}
</script>
</body>
</html>

解决方案 »

  1.   

    ie6 firefox下通过<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title></title>
        <script type="text/javascript">        var div1;
            window.onload = function()
            {
                div1 = document.getElementById("div1");
                document.documentElement.onclick = function() { div1.style.display = "none"; }
            }       
            
        
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div id="div1" style="position:absolute;display:block">
        fffffffffff
        </div>
        </form>
    </body>
    </html>
      

  2.   

    用onmouseout吧
    <div id='div' style=" height:300px; width:300px; background:#FF6600; display:none" onmouseout="hide()"> </div>
      

  3.   


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <title>无标题文档 </title> 
    </head> <body> 
    <div id='div' style="height:300px; width:300px; background:#FF6600; display:none"> </div> 
    <input value="queding" type="button"  onclick="show(event)" /> 
    <script> 
    var div = null; 
    window.onload =function(){div = document.getElementById("div")}; 
    function show(evt){ 
    div.style.display = "";
      if(window.event) event.cancelBubble =true;
      else evt.stopPropagation();
    } function hide(evt){
    var obj = window.event?event.srcElement:evt.target;
        if(obj!=div) div.style.display = "none"; 

    document.onclick=hide
    </script> 
    </body> 
    </html>