mardi 8 janvier 2019

JavaScript if indexOf list from a file

I would like to ask you if is possible to use function "if" "indexOf" to using if strings from a file (like .txt file contains a words).

I'm using if indexOf to checking if string is exists after typing to input from HTML code.

function checkBarcode()
{

var barcode  =  document.getElementById("barcodedata").value;       

if (barcode.indexOf('RMA') > -1) {
} else if (barcode.indexOf('sp') > -1) {

} else if (barcode.indexOf('D') > -1) {

} else if (barcode.indexOf('J') > -1) {

} else {
alert("message");

funcinvalid();
}

}

Thanks for helping.

Aucun commentaire:

Enregistrer un commentaire