2015-09-30 41 views
0

我有一個生成報表的表單操作。我想添加彈出式消息,如Please wait the report is loading在表單操作中添加彈出式等待消息

我該如何在js中執行此操作。

<form action="step50/generateReport" method="GET" id="form_generate"> 
     <input style="margin-top: 20px;" type="submit" id="btnGenerate" value="Generate"/>  
</form> 

我想這一點:

function popupProcessStatus(){       
       $.fancybox({href:'#display_status_inline', closeBtn: true, helpers:{overlay: {closeClick:false}}});        
     } 

<div id="display_status_inline" style="display: none">  
      <br> 
      <p>Please wait until the report is generated.</p>            
     </div> 

但不知道從哪裏調用這個函數,以顯示這是點擊BTN時,並生成報告時熄滅。

回答

1

只需調用該函數提交:

var form = document.getElementById("form_generate"); 
form.addEventListener("submit",popupProcessStatus,false); 
+0

做我需要的document.ready函數來調用這個? – PSDebugger

+0

是的,但要確保你的功能在那裏可用 – Saar