首页 > 解决方案 > 如何打开和更改选项卡 onclick 事件 html 的焦点

问题描述

我正在尝试创建一个跨度,当用户单击它时,它应该打开并更改当前选项卡在新选项卡上的焦点,打开上一个选项卡中想要的链接,除了 chrome 移动版之外,一切正常

<!doctype html>
<html lang="fr">
<head>
  <meta charset="utf-8">
  <title>Titre de la page</title>
  <link rel="stylesheet" href="style.css">
  <script src="script.js"></script>
</head>
<body>

<span data-href="https://clkde.tradedoubler.com/click?p=300883&a=3040124&g=24628776" class="BUTTON_NZV" style="border-radius: 7px;
    color: #FFFFFF;
    font-family: Arial;
    font-size: 31px;
    font-weight: 600;
    padding: 15px;
    background-color: #1BC325;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    text-align: center;

" onclick="window.open('#','_blank');window.open(this.getAttribute('data-href'),'_self');">OK</span>

</body>
</html>

http://wohnwagen-mieten.at/

标签: htmleventshyperlinkonclicktags

解决方案


推荐阅读