如何链接到另一个页面的选项卡部分?
我有一个网页,如果我单击页面中的链接,它应该被重定向到另一个网址的特定选项卡。也就是说,我的主页中有一个名为“已提交”的链接。如果我单击该链接,它会显示视图页面的“已提交”选项卡。这可能吗?
$status="Submitted";
<a id="formStatus<?php echo $status;?>" class="code_link" href="/FormBuilder/main/viewAllMyForms"><?php echo $status;?></a>
在我的 viewAllMyForms 页面中,我有一个选项卡部分,如
<ul id="sort_by" class="horizontal_navigation float_left">
<span class="showfilter">Show:</span>
<li> <a id="all" class="selected" href="#">All</a></li>
<li> <a id="drafted" href="#">Drafts</a></li>
<li> <a id="submitted" class="last" href="#">Submitted</a></li>
</ul>
在我的脚本中,我有以下代码,这样当我单击 viewAllMyForms 页面中的“已提交”选项卡时,仅显示状态为“已提交”的表单。
$('#submitted , #formStatusSubmitted').click(function(){
<?php foreach($myForms as $form):
if($form['Form']['status']=="Incompleted"){ ?>
$('.fm_myformsample_container'+<?php echo $form['Form']['id'];?>).hide();
<?php }
else{?>
$('.fm_myformsample_container'+<?php echo $form['Form']['id'];?>).show();
<?php }
endforeach;?>
$('#sort_by').find(".selected").removeClass();
$('#submitted').addClass("selected");
});
那么当我点击主页中的“已提交”链接时,如何将其连接到viewAllMyForms页面中的“已提交”链接呢?
I have a webpage and if I click a link in the page, it should be redirected to a particular tab of another url. That is, I have a link called 'Submitted' in my home page. If I click that link, it show display the 'Submitted' tab of the view page. Is this possible?
$status="Submitted";
<a id="formStatus<?php echo $status;?>" class="code_link" href="/FormBuilder/main/viewAllMyForms"><?php echo $status;?></a>
In my viewAllMyForms page, I have a tab section like
<ul id="sort_by" class="horizontal_navigation float_left">
<span class="showfilter">Show:</span>
<li> <a id="all" class="selected" href="#">All</a></li>
<li> <a id="drafted" href="#">Drafts</a></li>
<li> <a id="submitted" class="last" href="#">Submitted</a></li>
</ul>
In my script I have the below code, so that when I click the Submitted tab in my viewAllMyForms page, only the forms with status "Submitted" are displayed.
$('#submitted , #formStatusSubmitted').click(function(){
<?php foreach($myForms as $form):
if($form['Form']['status']=="Incompleted"){ ?>
$('.fm_myformsample_container'+<?php echo $form['Form']['id'];?>).hide();
<?php }
else{?>
$('.fm_myformsample_container'+<?php echo $form['Form']['id'];?>).show();
<?php }
endforeach;?>
$('#sort_by').find(".selected").removeClass();
$('#submitted').addClass("selected");
});
So When I click the "submitted" link in the home page, how to connect it to the "Submitted" link in the viewAllMyForms page?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该从第一页重定向到 secondarypage.html#subscribed
在 JavaScript 中,您检查 secondarypage.html 的 $(document).ready() 是否有可用的主题标签
,如果有“#subscribed”,则显示您页面的已提交部分。
You should redirect from the first page to secondpage.html#submitted
In JavaScript you check in the $(document).ready() of the secondpage.html if there is a hashtag available thru
and if there is '#submitted', you show the submitted part of your page.
我不完全确定你在问什么,但如果你想触发为选项卡制作的点击事件,那么你可以使用 jQuery trigger 带有井号标签,如 Jan 所建议:
然后设置您的链接以包含井号标签:
I'm not entirely sure on what you're asking, but if you want to trigger the click event that you made for your tabs, then you could use jQuery trigger with the hash tag, as suggested by Jan:
And then set up your link to include a hashtag: