【问题标题】:onclick="location.href='<?php the_permalink() ?>';" open in new windowonclick="location.href='<?php the_permalink() ?>';"在新窗口中打开
【发布时间】:2015-10-04 00:48:35
【问题描述】:

我必须制作一个 div 的链接

<div onclick="location.href='<?php the_permalink() ?>';></div>

让它按照我需要的方式工作。 (使用 Wordpress)

但我还需要使用 target="_blank" 在新窗口中打开链接,但我不知道如何将其应用于 div 中的 onclick。有人有什么想法吗?

【问题讨论】:

  • 你真的想要这里的 div。您可以为此使用&lt;a href="link" target="_blank"&gt;..&lt;/a&gt; 标签。

标签: jquery html css onclick target


【解决方案1】:

您总是可以通过 onclick 打开一个 javascript 函数并在其中执行您需要的任何操作。

或者如果你想要那种格式

<div onclick="window.open('<?php the_permalink() ?>')"></div>

【讨论】:

  • np,你总是可以接受答案并投票你知道吗? :)
  • 我需要更多的声誉
猜你喜欢
  • 2019-10-20
  • 1970-01-01
  • 2014-03-24
  • 2014-11-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多