在IE中输入IME菜单,在输入时触发键盘事件

时间:2015-12-08 15:37:20

标签: javascript html gwt ime

我在网页上有一个输入,触发搜索我的点击输入。

在GWT上看起来像这样

#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#define PI 3.141

void twoPoints ();
void hypotenuseInTriangular ();
void areaAndScopeInCircle (float radius);
void areaOfSquare ();
void areaOfRectangle ();


int main()
{
    int num=0 ;
    float radius=0;
    double ans1= 0,x1=0,x2=0,y1=0,y2=0;
    printf("hello friend, please enter one of the options: \n");
    printf("press 1 to calculate length between two points\n");
    printf("press 2 to calculate hypotenuse in right tringle \n");
    printf("press 3 to calculate area and scope in circle \n");
    printf("press 4 to calculate area of square \n");
    printf("press 5 to calculate area of rectangle \n");
    printf("press 6 to exit from the code \n");
    scanf("%d",&num);
    switch (num)
    {
        case 1:
            twoPoints(x1,x2,y1,y2);
            break;
        case 2:
            hypotenuseInTriangular();
            break;
        case 3:
            areaAndScopeInCircle (radius);
            break;
        case 4:
            areaOfSquare();
            break;
        case 5:
            areaOfRectangle();
            break;
        case 6:
            printf("bye!\n");
            break;
        default:
            printf("not good number \n");
            break;
    }
    system("PAUSE");
    return (0);
} 
/**
this funcion calculate the length between two points.
input: two points (x1,y1) (x2,y2).
output: the length between them.
*/
void twoPoints (double x1,double x2,double y1,double y2)
{
    double ans1=0,calculate1=0,calculate2=0;
    printf("enter  two integer points like this: x1 y1 x2 y2\n");
    scanf("%1f %1f %1f %1f",&x1,&y1,&x2,&y2);
    calculate1 = (x1 - x2) * (x1 - x2);
    calculate2 = (y1 - y2) * (y1 - y2);
    calculate1 += calculate2;
    calculate2 = sqrt(calculate1);
    printf("the length between your two points is: %f\n",calculate2);
}

/**
this funcion calculate the hypotenuse in right tringle using two ribs.
input: two integer numbers of the tringle.
output: the hypotenuse length.
*/
void hypotenuseInTriangular (double sideA,double sideB)
{
    double sideC=0.0,sum=0.0;
    printf("enter two ribs from the triangle: \n");
    scanf("%1f %1f",&sideA,&sideB);
    sum = (sideA * sideA + sideB * sideB);
    sideC = sqrt(sum);
    printf("your hyptenuse is %f \n",sideC);
}
/**
this funcion calculate area and scope using radius.
input: a radius number.
output: the area and the scope of this circle.
*/
void areaAndScopeInCircle (float radius)
{
    float area = 0,scope =0;
    printf("enter radius: \n");
    scanf("%f",&radius);
    area = PI * radius * radius;
    scope = PI * radius * 2;
    printf("the area of your circle is: %.1f\n",area);
    printf("the scope of your circle is: %.1f\n",scope);

}
/**
this funcion calculate area of square using two ribs.
input:  two integer numbers.
output: the area of the square.
*/
void areaOfSquare (int rib)
{
    printf("enter one of the square rib: \n");
    scanf("%d",&rib);
    printf("the area of your square is: %d\n",(rib*rib));
}
/**
this funcion calculate area of rectangle using two ribs.
input: two integer numbers.
output: the area of the rectangle.
*/
void areaOfRectangle (int length,int width)
{
    printf("enter length and than width\n");
    scanf("%d %d",&length,&width);
    printf("the area of your rectangle is: %d\n",(length*width));
}

来自日本的用户使用IME:

他输入一个单词,击中空格两次并看到一个菜单,他需要选择所需的拼写。 Menu looks like this 在Chrome和FF中,它可以正常工作,但在IE中,当用户按所需的拼写输入时,会触发输入上的keyUp处理程序。

所以我需要的是保持IE在IME菜单上触发此ENTER。

有什么建议吗?

1 个答案:

答案 0 :(得分:1)

我将KeyUpHandler切换为KeyDownHandler。 据我所知,弹出菜单隐藏了KeyDown事件,因此KeyUp在文本输入上被触发。