如何在新窗口中打开脚本/链接

How can I open the scripts/links into a new window?

本文关键字:链接 脚本 在新窗口中打开      更新时间:2023-09-26

这些书签脚本在target="_self"中打开。如何打开target="_blank"中的脚本/链接?

此:

<a href="http://www.reddit.com/submit" onclick="window.location = 'http://www.reddit.com/submit?url=' + encodeURIComponent(window.location); return false"> <img src="http://www.reddit.com/static/spreddit7.gif" alt="submit to reddit" border="0" /> </a>

这个:

<script type="text/javascript" src="http://www.reddit.com/buttonlite.js?i=1"></script>

您可以使用window.open(...)方法

<a href="#" onclick="window.open('http://www.reddit.com/submit?url=' + encodeURIComponent(window.location));">open window</a>

我真的不了解上下文,但你可以尝试在-tag或使用窗口中放入target="_blank"属性。open('http://www.reddit.com/submit?url='+encodeURIComponent(window.location));return false;

我认为第二个是你的解决方案。