翻译一篇文章'上.单击'PHP中的事件,来自'window.open'到基本URL链接

Translating an an 'on.click' event in PHP, from 'window.open' to a basic URL link

本文关键字:window 来自 事件 open URL 链接 PHP 一篇 文章 翻译 单击      更新时间:2024-01-05

我正试图对Joomla组件进行破解,以更好地满足我的需求。当前代码如下:

$eventprnt = 'onclick="window.open(''index.php?option=com_coupon&view=coupons&task=print_coupon&id='.$item->id.''')" ';
$eventcart = ' onclick="add_to_cart('.$item->id.');"';
$live_prt = 'coupon_print';$live_crt = 'coupon_cart';
if($item->coupon_type == 4){
    $dealevent = 'onclick="prompt_link('.$item->id.','.$final_price.',this)"';
}

$eventprnt函数当前打开一个浏览器窗口。我想将其转换为标准URL链接,同时保留onclick事件(即:不使用<a>或使用JScript <button>交换到echo(有多个调用,已附加到此触发器)。

我什么都试过了,语法让我很头疼。-我试过window.location而不是window.open,但没有用。

定位是可行的:

$eventprnt = 'onclick="location.href=''index.php?option=com_coupon&view=coupons&task=print_coupon&id='.$item->id.''';" ';