计算手风琴点击次数
Count Accordion Clicks
情况是这样的,我有手风琴,我喜欢计算用户每次打开手风琴的次数。
如何实现该功能。
谢谢,
凯文
我不确定你怎么称呼手风琴,但这并不重要;在你的脚本部分,你可以简单地添加一个函数:
var count = 0;
function eventCount() {
this.count++;
}
并根据需要在手风琴上简单地使用 hover(onmouseover="eventCount()"
) 或 click(onclick="eventCount()"
) 事件。
按钮示例:
<button onclick="eventCount()">Click me</button>
然后,通过在您的 javascript 中调用变量 count
,您将知道用户 clicked/hovered 手风琴
的次数
情况是这样的,我有手风琴,我喜欢计算用户每次打开手风琴的次数。
如何实现该功能。
谢谢, 凯文
我不确定你怎么称呼手风琴,但这并不重要;在你的脚本部分,你可以简单地添加一个函数:
var count = 0;
function eventCount() {
this.count++;
}
并根据需要在手风琴上简单地使用 hover(onmouseover="eventCount()"
) 或 click(onclick="eventCount()"
) 事件。
按钮示例:
<button onclick="eventCount()">Click me</button>
然后,通过在您的 javascript 中调用变量 count
,您将知道用户 clicked/hovered 手风琴