如何使用javascript检测#include<stdio.h>
#include<string.h>
#define SIZE 27
struct CountABC
{
char c;
int n;
}typedef CountABC_t;
char commonestLetter(char* filename)
{
CountABC_t ABC[SIZE];
int i,count=0;
char cha;
for (cha='A', i=0 ; i <=SIZE ; cha++,i++)
{
ABC[i].c= cha;
ABC[i].n = 0;
}
//printf("%c",ABC[3].c);
}
void main()
{
char* str = "ABBA GADDA LOLLAL";
char str2[SIZE];
char ch;
FILE* f = fopen("input.txt","w");
if (f == NULL)
{
printf("ERROR! Cannot Find Any File!!");
return;
}
fputs(str,f);
fclose(f);
ch = commonestLetter("input.txt");
}
,这是我的代码
ctrl+q
我只想用javascript做。
答案 0 :(得分:5)
您可以使用以下功能检测它:
<TextView
android:id="@+id/tv_dialog"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_centerInParent="true"
android:background="@android:color/darker_gray"
android:gravity="center"
android:textColor="#ffffffff"
android:textSize="30dp"
android:visibility="gone"/>
<com.myspace.maoyannew.view.MyLetterView
android:id="@+id/my_letterview"
android:layout_width="25dp"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_marginRight="2dp"
android:layout_marginTop="7dp">
</com.myspace.myspace.view.MyLetterView>
document.addEventListener("keydown", function (event) {
event.stopPropagation();
event.preventDefault();
if(event.ctrlKey && event.keyCode == 81)
{
console.log("CTRL + Q was pressed!");
}
else
{
console.log("Something else was pressed.");
}
});
和stopPropagation()
调用会阻止浏览器的默认行为发生。
如果您想检测其他密钥,此页面非常有用:http://asquare.net/javascript/tests/KeyCode.html