用不同的锚点重新加载页面 [英] Reload page with different anchor
问题描述
< a href =pictures.htm#tab2target =_ parent>
它只是在IE中需要的。它使用不同的哈希标签重新加载页面,但由于某些原因,Chrome和Firefox每次都加载相同的选项卡。我需要的是为链接创建一个 javascript函数,它将用不同的哈希标记完全重新加载页面。
我想出了这个代码:
函数gototab(重新加载)
{
window.location.href ='pictures.htm #TAB2' ;
window.location.reload(true);
}
< a href =pictures.htm#tab2onclick =gototab();>打开标签2< / a>
我觉得我几乎关闭了它,但是我的脚本出了问题。任何人都可以帮我解决它吗?
谢谢!
您可以这样做: 函数gototab(重新加载)
{
window.location.hash =' #TAB2' ;
window.location.reload(true);
}
< a href =pictures.htm#tab2onclick =gototab();>打开标签2< / a>
Just got stuck with one problem. I have a page with Jquery UI tabs. Each tab can be accessed from different page by adding a hash tag to the link and it loads the page with the tab that I need. However, I also need to access different tabs within the same page. What I came up with is to add target="_parent" to the link with hash tag:
<a href="pictures.htm#tab2" target="_parent">
and it does what I need but only in IE. It reloads the page with different hash tag but for some reason Chrome and Firefox load the same tab every time. What I need is to create a javascript function for the link which will fully reload the page with different hash tag.
I came up with this code:
function gototab(reload)
{
window.location.href = 'pictures.htm#tab2';
window.location.reload(true);
}
<a href="pictures.htm#tab2" onclick="gototab();">open tab 2</a>
I feel like I almost closed it but something is wrong with my script. Can anybody help me to solve it?
Thanks!
You can do this:
function gototab(reload)
{
window.location.hash = '#tab2';
window.location.reload(true);
}
<a href="pictures.htm#tab2" onclick="gototab();">open tab 2</a>
这篇关于用不同的锚点重新加载页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!