locked
pop up window contruction RRS feed

  • Question

  • User-583959464 posted
    my project embedded js library and cant does not has class attribute in html element like button, how can I create a pop up window with a button, once the user click the close button on pop up window, then the continue the submit form, the pop up window should be triggered in submit form js ? and the submit form js is triggered by <button type=submit/>
    Thursday, June 18, 2020 2:17 PM

All replies

  • User1535942433 posted

    Hi 20141113,

    As far as I think,you could cancel the submit,then open the new popup window.You could check if the popup window is closed or not.Finally,you could submit the form again.

    More details,you could refer to below codes:

    <script src="windowpopup.js"></script>  
     <form id="form1" action="/HtmlPage3.html">
            <input id="Text1" type="text" />
            <input id="Submit1" type="submit" value="submit" onclick="submitform(event)" />
        </form>
    function submitform(event) {
        event.preventDefault();
        var myWindow = window.open("", "MsgWindow", "width=600,height=600");
        myWindow.document.write("<p>This is 'MsgWindow'. I am 600px wide and 600px tall!</p>");
        var timer = setInterval(function () {
            if (myWindow.closed) {
                clearInterval(timer);
                document.forms['form1'].submit(); 
            }
        }, 1000);    
    }

    Best regards,

    Yijing Sun

    Friday, June 19, 2020 3:32 AM