如何在单击“提交”按钮时为“新建”窗口编写JavaScript,用“确定”和“取消”显示注册信息

how to code JavaScript for New window on clicking submit button displaying registration information with ok and Cancel?

本文关键字:确定 JavaScript 取消 信息 注册 显示 窗口 提交 单击 按钮 新建      更新时间:2023-09-26

我想要一个弹出框,其中包含用户名、电子邮件id等信息。点击提交按钮和确定和取消按钮,用JAVA脚本进行确认。如何在单击"提交"按钮时为"新建"窗口编写JavaScript,用"确定"answers"取消"显示注册信息。

<script type="text/javascript">
    if (confirm("Press 'OK' to leave, or 'Cancel' if you want to stay: "))
    {         
       window.location="http://google.com";
    }
    else
    {         
      <a href="javascript:history.go(-1)">Go back</a> 
    }
  </script>

可以使用JQUERY UI

您可能需要检查中的ModalForm

$( "#dialog-form" ).dialog({
            autoOpen: false,
            height: 300,
            width: 350,
            modal: true,
            buttons: {
                "Create an account": function() {
                    var bValid = true;
                    allFields.removeClass( "ui-state-error" );

                    if ( bValid ) {
                        $( "#users tbody" ).append( "<tr>" +
                            "<td>" + name.val() + "</td>" + 
                            "<td>" + email.val() + "</td>" + 
                            "<td>" + password.val() + "</td>" +
                        "</tr>" ); 
                        $( this ).dialog( "close" );
                    }
                },
                Cancel: function() {
                    $( this ).dialog( "close" );
                }
            },
            close: function() {
                allFields.val( "" ).removeClass( "ui-state-error" );
            }
        });