简体   繁体   English

在新窗口/标签中打开链接

[英]Open links in new Window/Tab

I cant seem to figure out how to get the links to open in a new window or tab. 我似乎无法弄清楚如何在新窗口或新标签页中打开链接。 Feeling like a total newbie. 感觉像一个新手。 Any thoughts? 有什么想法吗? Live link: http://wp11004271.server-he.de/alloytoy5.5.1/ 实时链接: http//wp11004271.server-he.de/alloytoy5.5.1/

        function RenderItem(number, item) {
            if (typeof item != "undefined")
                return "<div class='bit-5'>\n\
                            <a href='" + item.link + "' id='alloy_" + number + "'>\n\
                                 <p class='alloy' >\n\
                                    " + item.name + "\n\
                                </p>\n\
                            </a>\n\
                        </div>";

            else
                return "";
        }

You just need a target attribute; 您只需要一个target属性; _blank in this case. _blank在这种情况下。

<a href='" + item.link + "' target='_blank' id='alloy_" + number + "'>\\n\\

You can find the supported values of this attribute here: http://www.w3schools.com/tags/att_a_target.asp 您可以在此处找到此属性的受支持值: http : //www.w3schools.com/tags/att_a_target.asp

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

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