简体   繁体   English

在新窗口中打开标签,然后

[英]Open up tab in a new window and

I have a tab-viewer written in html/css/javascript which I would like to change a bit, right now when I switch each tab all it does is switch the content. 我有一个用html / css / javascript编写的标签查看器,我想稍作更改,现在当我切换每个标签时,它所做的就是切换内容。 What I would like to do is open each tab up in a new window and id like each tab to be in separate files. 我想做的是在新窗口中打开每个选项卡,并像每个选项卡一样将其ID放在单独的文件中。

Is there any easy way of doing this? 有没有简单的方法可以做到这一点?

Put a link on the tabs with target="_blank" 在选项卡上放置带有target="_blank"

<a href="tab1.html" target="_blank">Tab1</a>

Edit: The target attribute might be deprecated (or not: see @Tim Medora's comment) but is supported in all major browsers ( http://www.w3schools.com/tags/att_a_target.asp ) and is as close as you can get imo. 编辑:不建议使用target属性(或不建议使用:请参阅@Tim Medora的注释),但所有主要浏览器( http://www.w3schools.com/tags/att_a_target.asp )都支持该属性,并且该属性尽可能地接近imo。 From w3schools.com: _blank: Opens the linked document in a new window or tab 从w3schools.com:_blank: _blank: Opens the linked document in a new window or tab

for simplicity id like to store the content in separate files, otherwise it gets rather extensive in each page 为了简单起见,id希望将内容存储在单独的文件中,否则在每个页面中内容都会变得相当广泛

How about jQuery UI tabs + AJAX? jQuery UI选项卡+ AJAX怎么样?

Docs: http://jqueryui.com/demos/tabs/#ajax 文件: http//jqueryui.com/demos/tabs/#ajax
Demo: http://jqueryui.com/demos/tabs/ajax.html 演示: http//jqueryui.com/demos/tabs/ajax.html

Or, if you already have your own tab control, you could detect the tab change with a bit of JS and load the content dynamically with AJAX. 或者,如果您已经拥有自己的选项卡控件,则可以使用一些JS检测选项卡的更改,然后使用AJAX动态加载内容。

If you really want new windows (unclear from the question), then the use of tabs is misleading. 如果您确实想要新窗口(问题尚不清楚),则使用选项卡会产生误导。 At that point it should just be a menu. 那时它应该只是一个菜单。 I would be confused/frustrated if tabs all opened in new windows. 如果选项卡全部在新窗口中打开,我会感到困惑/沮丧。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM