Jquery对话框按钮在FancyBox中调用页面

时间:2013-11-19 13:31:47

标签: javascript jquery fancybox

我有一个href标签,我在fancybox中调用一个表单。这就是它的完成方式;

<a class="fancybox fancybox.iframe" caption ="Registration" href="registration.htm">Registration</a>

当用户点击链接时,该页面会在 fancybox 中打开。我现在已经使用按钮实现了 jquery 对话框,当用户单击对话框中的按钮时,我正尝试按上述方式调用注册页面。怎么能实现这一目标?这是我到目前为止:

Jquery对话:

$( "#userOptions-dialog" ).dialog({
        autoOpen: false,
        height: 100,
        width: 380,
        resizable:false,
        modal: true,
        buttons: {
            "Cancel": function() {$( this ).dialog( "close" );},

            "Register": function() {
                //how can i call the href tag here          
            }
    });

1 个答案:

答案 0 :(得分:1)

这对我有用,添加了css隐藏链接并使用简单的javascript调用点击链接。

<强> HTML

<a id = "registration" class="fancybox fancybox.iframe" caption ="Registration" href="registration.htm">Registration</a>

<强> CSS

#registration{
display:none;
}

<强> jquery的

$( "#userOptions-dialog" ).dialog({
        autoOpen: false,
        height: 100,
        width: 380,
        resizable:false,
        modal: true,
        buttons: {
            "Cancel": function() {$( this ).dialog( "close" );},

            "Register": function() {
                $("#registration").click();      
            }
    });