0

我试图start从下面调用按钮restart它不起作用我该如何实现它?因为它在取消按钮情况下工作

        $( "#flash_screen" ).dialog({
            autoOpen: false,
            height: 500,
            width: 1050,
            modal: true,
            buttons: {
                "Start": function() { alert('start');
                },

                restart: function(){

                $( this ).dialog( "Start" );

                },

                Cancel: function() {
                    $( this ).dialog( "close" );
                    }
                },
                close: function() {
                allFields.val( "" ).removeClass( "ui-state-error" );
                }
            });
4

1 回答 1

0

您实际上并没有调用 Close 函数 - 您正在将“close”命令传递给dialog调用定义的close事件处理程序的 。

要执行您想要的操作,您应该创建一个单独的Start函数,将其指定为事件处理程序restartstart事件处理程序:

function startHandler () { alert('start'); }

$( "#flash_screen" ).dialog({
        autoOpen: false,
        height: 500,
        width: 1050,
        modal: true,
        buttons: {
            "Start": startHandler,

            restart: startHandler,

            Cancel: function() {
                $( this ).dialog( "close" );
                }
            },
            close: function() {
            allFields.val( "" ).removeClass( "ui-state-error" );
            }
        });
于 2012-08-03T17:27:47.557 回答