Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
单击按钮后,我想在另一个选项卡/窗口上打开 pdf。我试图设置 onclick="winodw.location.href" 但它仍然在同一页面/窗口中打开。以下是我的代码。
<input type="button" value="Report" onclick="location.href='showpdf?&name=${Name}'">
任何输入
用于target="_blank" 在新标签页中打开
target="_blank"
将您的输入按钮更改为:
<input type="button" value="Report" onclick="window.open('showpdf?&name=${Name}','_blank')">
不同之处在于“window.open”将打开一个新窗口,而“window.location.href”将重定向页面。