如何在加载弹出窗口时在空白弹出窗口中添加启动画面

时间:2018-02-23 09:36:34

标签: javascript function jsp

这个功能会弹出一个空白窗口,几秒后只显示pdf,在这个弹出的空页面可以添加启动画面吗?或有任何建议?

function popupPDF() {
    page = window.open('', 'policy','toolbar=0,scrollbars=0,location=0,scrollbars=1,statusbar=0,menubar=0,resizable=1,width=750,height=530,left=50,top=10');
    page.focus();
    lockButton();
    document.mainform.Close.disabled = false;
    document.mainform.action = "html2pdf.jsp";
    document.mainform.target = 'policy';
    document.mainform.SUBMITIND.value ="Y";    
    document.mainform.submit();
   }

1 个答案:

答案 0 :(得分:0)

只需添加page.document.write

即可
    function popupPDF() {
        page = window.open('', 'policy','toolbar=0,scrollbars=0,location=0,scrollbars=1,statusbar=0,menubar=0,resizable=1,width=750,height=530,left=50,top=10');
        page.document.write('<html><head><title>e-ASC - Generate Document</title><meta name="viewport" content="width=device-width, initial-scale=1"><style>.loader {border: 16px solid #f3f3f3;border-radius: 50%;border-top: 16px solid #3498db;width: 120px;height: 120px;-webkit-animation: spin 2s linear infinite; /* Safari */animation: spin 2s linear infinite;margin-left: auto;margin-right: auto;}@-webkit-keyframes spin {0% { -webkit-transform: rotate(0deg); }100% { -webkit-transform: rotate(360deg); }}@keyframes spin {0% { transform: rotate(0deg); }100% { transform: rotate(360deg); }}</style></head><body><h2 align="center">Please wait ...</h2><div class="loader"/></body></html>');
        page.focus();
        lockButton();
        document.mainform.Close.disabled = false;
        document.mainform.action = "html2pdf.jsp";
        document.mainform.target = 'policy';
        document.mainform.SUBMITIND.value ="Y";    
        document.mainform.submit();
       }