php - PHP:使用 onclick 在新窗口(不是新选项卡)中打开 href
问题描述
我试图在 php 中包含一个 onclick javascript,但我无法让它正常工作。该链接将在浏览器的新选项卡中打开,但不会在 Javascript 所做的新窗口中打开。
我相信我已经正确地转义了单引号,这就是我认为的问题所在。
请参阅下面的 php 代码。
$image = sprintf( '<div class="wpcp-slide-image"><a onclick="window.open(this.href, \'left=20,top=20,resizable=0\'); return false;" href="'.$custom_notification_data.'">%1$s</a></div>', $post_thumb, get_the_permalink() );
解决方案
推荐阅读
- python - 让 Telebot 将新用户静音 24 小时
- json - 如何正确遍历 apache freemarker 中的列表键、值对?
- c# - WPF - 使用按钮停止调度程序计时器
- webdriver-io - 获取 TypeError:browser.saveElement 和 browser.checkElement 不仅仅是 JENKINS 中的函数,它在本地机器上正常工作
- reactjs - 你如何提高 Gitlab 管道的性能?
- flutter - Flutter Dio:DioError [DioErrorType.RESPONSE]:Http 状态错误 [429]
- debugging - Freemarker 调试器 api 的实现
- node.js - nodejs:使多个http请求异步暂停响应
- asp.net - 从子模块注册 ASP.Net Core 控制器
- jqgrid - 如何在 JQGrid 中连续获取特定单元格的值?