Using event.which to verify if the user pressed the spacebar doesn't work in Firefox

后端 未结 4 573
粉色の甜心
粉色の甜心 2021-01-06 07:59

I want a script to verify if the key pressed is \'spacebar\', keycode 32. I noticed that IE uses other function names.

I tried a lot of solutions found here and this

4条回答
  •  一生所求
    2021-01-06 08:14

    EDIT

    HMTL:

    
    
    

    JS:

    function predicao(objeto){
        var comprimento = objeto.value.length;
        var antipenultimo = comprimento - 4;
        var input = objeto.value.substring(antipenultimo,comprimento);
        var output = "";
        for(var i=0; i

    I used here what Alexander Kahoun and pimvdb have posted.

提交回复
热议问题