使用 Dojo 链接到特定选项卡/内容窗格
我想从 html 站点上的链接导航到具有两个不同选项卡的 TabContainer 所在的另一个链接。
我在目标 html 文件中默认选择了一个选项卡(我想保留该选项卡)。
我必须如何放置链接才能使其正常工作?我在网上找到了几个文档,但没有任何效果。所以可能需要有人以愚蠢的方式向我解释这一点。
这是目标 TabContainer:
<div dojoType="dijit.layout.TabContainer" region="center" tabStrip="true">
<div dojoType="dijit.layout.ContentPane" title="Contact" selected="true">
some text
</div>
<div dojoType="dijit.layout.ContentPane" title="Imprint" selected="true">
some text
</div>
我想放置一个链接以自动导航到标题“Imprint”。
有人可以帮忙吗?
非常感谢,祝一切顺利 TTP
I want to navigate from a link on a html site to another where a TabContainer with two different tabs is located.
I have one tab selected by default (which I want to keep) in the destination html file.
How do I have to put the link so that this is working? I found several documents on the net but nothing works. So probably someone needs to explain this to me the dumb way.
Here is the destination TabContainer:
<div dojoType="dijit.layout.TabContainer" region="center" tabStrip="true">
<div dojoType="dijit.layout.ContentPane" title="Contact" selected="true">
some text
</div>
<div dojoType="dijit.layout.ContentPane" title="Imprint" selected="true">
some text
</div>
I want to place a link to autmatically be navigated to the title "Imprint".
Can someone help?
Thanks a lot and all the best
TTP
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以从 javascript 选择它,也可以从服务器生成选项卡的标记,并将
selected
属性设置为true
(您需要将另一个设置为假)。第二种选择取决于您的服务器技术。
对于第一个选项,将 id 添加到容器和选项卡中,并在页面加载完成时选择选项卡。例如:
如果您想动态选择任一选项卡,则需要将 URL 中的某种参数传递到您的页面。您可以使用查询参数(
?
符号后面的变量)或哈希片段(#
后面的任何内容)。您可以从服务器和 JavaScript 读取查询参数。哈希片段,仅来自 javascript。您可以通过检查
location
对象来访问这些参数。例如,使用哈希片段,您可以链接到您的页面,例如http://host/page.html#imprint
。然后在上面的标签中:
对于查询参数,另请参阅
dojo.queryToObject()
。You can either select it from javascript, or generate the markup for the tab from your server with the
selected
attribute totrue
(you'll need to set the other tofalse
). This second alternative, depends on your server technology.For the first option, add ids to the container and tabs and select the tab when the page finished loading. Something like:
If you want to dynamically select either tab, you'll need to pass some kind of parameter in the URL to your page. You can use a query parameter (variables after the
?
symbol) or a hash fragment (anything after#
). Query parameter you can read both from the server and from javascript. Hash fragments, only from javascript.You can access those parameters by inspecting the
location
object. For example, using a hash fragment, you'd link to your page likehttp://host/page.html#imprint
. Then in the<script>
tag above:For query parameters, also see
dojo.queryToObject()
.