繁体   English   中英

事件参数未传递给JavaScript函数

[英]Event argument not passed to JavaScript function

我将名为DagOpenFlyout单击事件侦听器onclick DagOpenFlyoutspan元素:

"<span class=\"btnFlyout\" id=\"btn" + i + "\" style=\"width: " + cellW + "px; cursor: pointer;\"  onclick=\"DagOpenFlyout('cell" + i + "', " + i + ")\">\n"

这是该函数的实现:

function DagOpenFlyout(elt, tbItemIndex)
{   
    parent.parent.mapFrame.OpenFlyout(500, tbItemIndex);
}

DagOpenFlyout函数上,我需要传递event参数,在DagOpenFlyout函数中,我需要访问client.X和client.Y事件参数的属性。

如何将event参数传递给DagOpenFlyout函数?

通过onClick处理程序关闭DagOpenFlyout函数。

function DagOpenFlyout(elt, tbItemIndex) {
    return function(event) {
        // You can access event argument here in the onClick handler.
    };
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM