Javascript window.location在新选项卡中打开链接

Javascript window.location在新选项卡中打开链接,javascript,hyperlink,window.open,window.location,Javascript,Hyperlink,Window.open,Window.location,到目前为止我有 <div style="position: absolute; left: 47%; top: 70%; margin-right: -52%; transform: translate(-50%, -50%)" onclick="window.location='https://steamcommunity.com/';"> 我想在新选项卡中打开此页,但使用window.open时出现问题,因为类是图像。有什么建议吗?您可以使用target=“\u blank

到目前为止我有

<div style="position: absolute; left: 47%; top: 70%; margin-right: -52%; transform: translate(-50%, -50%)" onclick="window.location='https://steamcommunity.com/';">


我想在新选项卡中打开此页,但使用window.open时出现问题,因为类是图像。有什么建议吗?

您可以使用target=“\u blank”:



您是如何尝试使用
窗口的。是否打开
?你说的“因为类是图像”是什么意思?我没有使用href,我使用的是window.location,出于某种原因我无法指定目标
<a href="https://steamcommunity.com/'"  target="_blank"/>