单击html中的按钮后,在另一个选项卡上打开PDF

时间:2013-05-09 13:15:43

标签: html jsp

我想在点击按钮后在另一个标签/窗口上打开pdf。 我试图设置onclick =“winodw.location.href”,但它仍然在同一个页面/窗口中打开。 以下是我的代码。

<input type="button" value="Report"  onclick="location.href='showpdf?&name=${Name}'">

任何输入

2 个答案:

答案 0 :(得分:1)

使用target="_blank"在新标签页中打开

答案 1 :(得分:0)

更改输入按钮:

<input type="button" value="Report"  onclick="window.open('showpdf?&name=${Name}','_blank')">

不同之处在于“window.open”将打开一个新窗口,“window.location.href”将重定向页面。

相关问题