[英]OnClick working or not in enter key press?
I have a button in my page ,for which i need to track every hit on it 我的页面上有一个按钮,需要跟踪该按钮上的所有点击
<button id="searchbutton" type="submit"
onclick="_gaq.push(['_trackEvent','search','Click','FClicks',1.00,true]);"
name="Søg"></button>
Now what i want to know is weather this onclick script will work on enter press or not? 现在我想知道的是,此onclick脚本是否可以在enter press上运行? I want to log every click on this button and I am not sure if user presses enter key deos this work or not? 我想记录该按钮的每次点击,而且我不确定用户是否按Enter键即可完成此工作吗? Can any one help me out here? 有人可以帮我从这里出去吗?
You could take the Javascript out of the onclick
event, and place it to the form onsubmit
to be sure. 您可以从onclick
事件中删除Javascript,然后将其放在onsubmit
表单onsubmit
以确保。 It would also help you if you generally place the code you need in a function and call that function in the form's onsubmit
. 如果您通常将所需的代码放在函数中并在表单的onsubmit
调用该函数,这也将对您有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.