javascript - 如何实现 HTML5 DoubleClick ClickTag?

标签 javascript html double-click banner clicktag

我创建了一个 html5 横幅并在此处对其进行了验证: https://h5validator.appspot.com/dcm .

它返回错误:“缺少点击代码检查”。

如何实现 clickTag?我在谷歌支持上找到了这段代码:

<html>
  <head>
    <meta name="ad.size" content="width=300,height=250">
    <script type="text/javascript">
      var clickTag = "http://www.google.com"; 
    </script>
  </head>

  <body>
    <a href="javascript:window.open(window.clickTag)">
      <img src="images/dclk.png" border=0>
    </a>
  </body>
</html>

但在 DoubleClick 中上传 ZIP 文件后,横幅的目标 URL 不是设置了吗?

我是否必须设置在 HTML 中硬编码的目标 URL?对我来说没有任何意义..

我过去制作了很多 flash 横幅,而你只提到了一个变量 _root.clickTag。

谁能帮帮我?

谢谢

最佳答案

为了创建 doubleclick studio 横幅,您需要导入 doubleclick studio 库并初始化启用程序。然后设置 Exit_url。省去所有麻烦,在 Google Web Designer 中创建横幅非常简单,并且会直接上传到 DC studio

    <script src="https://s0.2mdn.net/ads/studio/Enabler.js"></script>

       <style>html, body {width: 100%; height: 100%}
        #bg-exit {
        background-color: rgba(255,255,255,0);
        cursor: pointer;
        height: 381px; //banner height
        left: 0px;
        position: absolute;
        top: 19px;
        width: 400px; //banner width
        z-index: 1;
    }</style>

   <div id="bg-exit"></div> <!-- put this div inside your main container of banner -->

<script>
    window.onload = function() {
  if (Enabler.isInitialized()) {
    enablerInitHandler();
  } else {
    Enabler.addEventListener(studio.events.StudioEvent.INIT, enablerInitHandler);
  }
}

function enablerInitHandler() {

}
    function bgExitHandler(e) {
  Enabler.exit('Background Exit');
}

document.getElementById('bg-exit').addEventListener('click', bgExitHandler, false);
    </script>

使用此代码,您可以从 DC studio 动态更改 exit_url

关于javascript - 如何实现 HTML5 DoubleClick ClickTag?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35552392/

相关文章:

javascript - 从 k6 中的文件读取

html - 如何将样式表附加到 HTML 电子邮件?

html - 使用百分比值创建 CSS 动画关键帧

javascript - Google Web Designer 横幅 验证时缺少点击标记检查

javascript - 如何使用 .css() 应用 !important?

javascript - 当 div 清空时,Ajax 加载的弹出图像并不总是清除

javascript - 如何在 Google Maps V3 上居中和缩放多个标记

javascript - 在 jQuery 中迭代复选框

javascript - 当用户提交表单时触发 Google DoubleClick 代码

kendo-ui - 剑道窗口禁用双击最大化