一个头疼的问题,在线等
我要作一个功能:当这个画面上被修改了资料后,如果没有保存去点其他的画面,就要提示User,现在的问题是,不知道怎么写该document的失去焦点的事件。试过了,onfocusout,ondeactivate都不是理想的解决方案。请各位大侠帮帮忙。
------解决方案--------------------onblur 
 document的我还是真的没有使过 
 window的这个事件我使过  
 我做了一个当前窗体失去焦点时 再让它得到焦点   
 document也有这个事件,你看看吧
------解决方案--------------------简单,所有滴 input 都有一个 defaultValue 属性,checkbox 和 radio 应该检查 defaultChecked 是否变化!   
 提交页面时用当前值与 defaultValue 比较一下即可!   
 L@_@K   
  <!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>  
    <title> page check </title>  
    <meta name= "generator " content= "editplus " />  
    <meta name= "author " content= "yixianggao@126.com " />  
    <meta name= "keywords " content= "javscript " />  
    <meta name= "description " content= "for javascript region of csdn " />  
   </head>    
   <body>  
    <input type= "text " id= " " />  
    <input type= "text " id= " " />  
    <input type= "checkbox " id= " "  />  
    <input type= "button " id= " " value= "check " onclick= "checkPage(); " />  
    <script type= "text/javascript ">  
    <!-- 
 function checkPage() 
 { 
     var colInput = document.getElementsByTagName( "input "); 
     var oInput; 
     var isAlert = false;   
     for (var i=0; i <colInput.length; i++) 
     { 
         oInput = colInput[i]; 
         switch (oInput.type) 
         { 
             case  "text ": 
             case  "file ": 
                 if (oInput.defaultValue != oInput.value) isAlert = true; 
                 break; 
             case  "checkbox ": 
             case  "radio ": 
                 if (oInput.defaultChecked != oInput.checked) isAlert = true; 
                 break; 
                 break; 
         } 
         if (isAlert) 
         { 
             alert( "还没保存呢~~~ "); 
             return false; 
         } 
     } 
 } 
   //-->  
    </script>  
   </body>  
  </html>