用按钮打开一个新窗口?

Pom*_*ter 1 asp.net-mvc jquery new-window

我需要打开一个新窗口进行打印,有人可以告诉我该怎么做吗?

我的按钮点击代码:

我的 window.location 有效,但不能使用 window.open

$('.btnFromIndexPrint').click(function () {
    if (document.URL.indexOf('index') > -1) {
         // window.location = '../Print/' + $(this).attr('id');
         window.open = '../Print/' + $(this).attr('id');
    } else {
        //window.location = 'Contract/Print/' + $(this).attr('id'); //Redirect  from Index page to print action
        window.open = 'Contract/Print/' + $(this).attr('id');
    }

});
Run Code Online (Sandbox Code Playgroud)

我的html:

我知道有一种叫做 target ="blank" id 的东西不认为它会起作用。

<input type="button" value="Print" class="btnFromIndexPrint" id="@item.SalesContractId"/>
Run Code Online (Sandbox Code Playgroud)

我将如何在新页面上打开重定向?

重要的!!!!!!!

return RedirectToAction("Print", new { id = contractInstance.SalesContractId });
Run Code Online (Sandbox Code Playgroud)

Sud*_*oti 5

应该:

window.open(url_or_your_page);
Run Code Online (Sandbox Code Playgroud)

请参阅:示例