在同一个标签中打开多个网页
报表中有多个超链接,每次单击超链接时,网页都会在新选项卡中打开,
是否可以使用javascript在一个选项卡而不是多个选项卡中打开超链接?
请帮助
Have multiple hyperlinks in a report, everytime a click on a hyperlink the webpage opens in a new tab, Is it possible to open the hyperlinks in only one tab instead of multiple tabs using javascript ? Please help
我目前正在使用window.open打开网页,我无法使用目标。下面是代码:
I am currently using window.open to open the webpages, I cannot use target. Below is the code :
I basically have a jqgrid where all the values of a column have hyperlink,
if (GridColNum == 2) //index of the column
{
localStorage.valuekey = $('#filters_grid').jqGrid('getCell', GridRowId, 1);
window.open('http://mywebpage.html');
}
我使用localstorage功能在另一个页面中使用点击的值
And i am using the clicked value in another page using localstorage feature
是的,这是可能的。使用语法
Yes, it's possible. Use syntax
<a href="..." target="rptTab"/>
。这样,第一次单击链接时,将打开一个新选项卡;对于后续点击,该标签将被重复使用。
for all relevant links. This way the first time a link is clicked a new tab will be opened; for subsequent clicks, that tab will be reused.
编辑:如果您使用打开javascript中的链接window.open
,然后你需要指定选项卡/窗口的名称作为第二个参数:
if you're opening the link in javascript using window.open
, then you need to specify the name of the tab/window as the second parameter:
window.open('http://mywebpage.html', 'rptTab');