0

I have a form with a field like:

<td width='30%' align='center'> 
    <input name='prod_partnum1' type='text'  id='prod_partnum1' size='20' maxlength='20'  color='#333333' value='$prod_partnum1'>
</td>  

<td width='30%' align='center'>
    <input onchange='ceck_modulo1();' id='prod_partnumver1' name='prod_partnumver1' value=''>
</td>

and this is java for check_modulo

function check_modulo1() {
    <!---->
    if (document.modulo.prod_partnumver1.value == "" || document.modulo.prod_partnumver1.value != document.modulo.prod_partnum1.value) {
        document.modulo.prod_partnumver1.value = "";
        document.modulo.prod_partnumver1.style.backgroundColor = "#FF0000";
        document.getElementById('line1').style.backgroundColor = "#FF0000";
        document.modulo.prod_partnumver1.innerHTML = '<audio autoplay="autoplay"><source src="NuclearAlert.mp3" type="audio/mpeg" /><embed hidden="true" autostart="true" loop="false" src="NuclearAlert.mp3" /></audio>';
        document.modulo.prod_partnumver2.focus();
        document.modulo.prod_partnumver1.focus();
    } else {
        document.modulo.prod_partnumver1.innerHTML = '<audio autoplay="autoplay"><source src="SmallBlink.mp3" type="audio/mpeg" /><embed hidden="true" autostart="true" loop="false" src="SmallBlink.mp3" /></audio>';
        document.modulo.prod_partnumver1.style.backgroundColor = "#008800";
        document.getElementById('line1').style.backgroundColor = "#008800";
        document.modulo.prod_partnumver2.focus();
    }

onchange works just with crome and ff but not with any version of internet explorer 7 , 11

The problem is: the text field prod_partnumver1 is field to write barcode scanned by barcode gun, and when a put barcode with a gun if is crome work perfect with internet explorer, not for working need I click with the mouse in another text field. With chrome it works perfect when a write with barcode scanner verify the field and if is correct go to the next... like java ceck_modulo1 work.....

Thanks for any help.

Huangism
  • 16,278
  • 7
  • 48
  • 74
  • Possible duplicates: http://stackoverflow.com/questions/6290442/html-input-type-text-onchange-event-not-working – Krish R Mar 13 '14 at 15:20
  • your onchange event has a typo 'ceck_modulo(1)' should be 'check_modulo(1)', right? – Phlume Mar 13 '14 at 15:20

2 Answers2

0

onchange support in IE7 is limited, you should use onclick instead. Further reading on the subject.

eclipsis
  • 1,541
  • 3
  • 20
  • 56
  • on click need user action .... onchange the field is verified and the cursor go to the next product automatically.... nobody have a right solution please... – user2024752 Mar 13 '14 at 16:48
  • on click need user action to put cursor in other field.... onchange is better because the cortrol start and the cursor stay in the same testfield if is incorret and go to the next textfield if is corret..(java check_modulo1) anyone have a solution for that problem pleease ? – user2024752 Mar 13 '14 at 16:50
0

ok guy's i find solution and i write for other....need mybe tomorrow

ie not work with onchange so....

<SCRIPT LANGUAGE="JavaScript">
var to;
function callMe1(ms) {
     clearTimeout(to);
     to = setTimeout(function() {


<!---->



if (  document.modulo.prod_partnumver1.value == "" || document.modulo.prod_partnumver1.value != document.modulo.prod_partnum1.value  ){



    document.modulo.prod_partnumver1.value = "";

     document.modulo.prod_partnumver1.style.backgroundColor="#FF0000";

     document.getElementById('line1').style.backgroundColor="#FF0000" ;

     document.modulo.prod_partnumver1.innerHTML='<audio autoplay="autoplay"><source src="NuclearAlert.mp3" type="audio/mpeg" /><embed hidden="true" autostart="true" loop="false" src="NuclearAlert.mp3" /></audio>';    

     document.modulo.prod_partnumver2.focus();

     document.modulo.prod_partnumver1.focus();




}





else 

{

         document.modulo.prod_partnumver1.innerHTML='<audio autoplay="autoplay"><source src="SmallBlink.mp3" type="audio/mpeg" /><embed hidden="true" autostart="true" loop="false" src="SmallBlink.mp3" /></audio>';

        document.modulo.prod_partnumver1.style.backgroundColor="#008800";

        document.getElementById('line1').style.backgroundColor="#008800" ;

        document.modulo.prod_partnumver2.focus();


}

}, ms);
}

</SCRIPT>

in this way use the onkeyup function,(not onchange) but wait 200ms in order to give me time for shot with barcode gun

thank's