更新时间:2023-09-07 16:25:10
如果您的页面仅包含链接,请考虑 < base target =_ blank>
。这将打开新窗口中的每个链接(但也包括窗体的目标,除非用< form target =_ self>
。
If you have a page consisting of only links, consider <base target="_blank">
. This opens every link in a new window (but also includes the targets of forms, unless overridden with <form target="_self">
.
正如其他人所示,在不修改HTML源代码的情况下,您可以使用JavaScript来遍历所有< a>
标记并添加目标
属性或添加事件侦听器,动态设置目标属性。
As others have shown, without modifying the HTML source, you can use Javascript to iterate through all <a>
tags and add the target
attribute or add an event listener that sets the target attribute dynamically.