Jquery 如何在新窗口中打开表单单击sumbit按钮并提交表单以及更改操作

Jquery 如何在新窗口中打开表单单击sumbit按钮并提交表单以及更改操作,jquery,asp.net-mvc-4,visual-studio-2012,razor,Jquery,Asp.net Mvc 4,Visual Studio 2012,Razor,我想在提交时尝试更改操作,单击并打开新窗口,在新选项卡中打开并工作,但我想在新窗口中打开 @using (Html.BeginForm(null, null, FormMethod.Post, new { id = "ReferralForm" })) { 要获得一个弹出窗口,而不是一个新的标签,你必须设置窗口的尺寸。我刚才在线查看了一下,发现了这个功能 function PopupCenter(url, title, w, h) { // Fixes dual-screen

我想在提交时尝试更改操作,单击并打开新窗口,在新选项卡中打开并工作,但我想在新窗口中打开

@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "ReferralForm" }))
{


要获得一个弹出窗口,而不是一个新的标签,你必须设置窗口的尺寸。我刚才在线查看了一下,发现了这个功能

function PopupCenter(url, title, w, h) {
        // Fixes dual-screen position                         Most browsers      Firefox
        var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left;
        var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top;

        width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
        height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;

        var left = ((width / 2) - (w / 2)) + dualScreenLeft;
        var top = ((height / 2) - (h / 2)) + dualScreenTop;
        var newWindow = window.open(url, title, 'model=yes,menubar=no,status=no,toolbar=no,location=no,width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);

        // Puts focus on the newWindow
        if (window.focus) {
            newWindow.focus();
        }
    }
我不记得源代码给了他们信任。然后你像这样调用函数

var url = '@Url.Action("FacebookLogin", "Agent")';
PopupCenter(url, "Popup", 800, 600);    

我找到了这个函数,因为它决定了你的窗口大小,并设置了窗口,使其在打开时居中。希望这有帮助。

这是特定于浏览器的引用,我有两个按钮,单击一次我更改了表单的操作。。那么单击一次更改操作如何?…在新窗口中打开但不触发FaceBook登录操作错误,因为p新窗口打开$('#ReferralForm').attr({action:'@Url.action(“FacebookLogin”,“Agent”)”),目标:'_blank'操作后的ost数据也会在单击时提供给它,因此它不会执行此功能
function PopupCenter(url, title, w, h) {
        // Fixes dual-screen position                         Most browsers      Firefox
        var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left;
        var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top;

        width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
        height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;

        var left = ((width / 2) - (w / 2)) + dualScreenLeft;
        var top = ((height / 2) - (h / 2)) + dualScreenTop;
        var newWindow = window.open(url, title, 'model=yes,menubar=no,status=no,toolbar=no,location=no,width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);

        // Puts focus on the newWindow
        if (window.focus) {
            newWindow.focus();
        }
    }
var url = '@Url.Action("FacebookLogin", "Agent")';
PopupCenter(url, "Popup", 800, 600);