English 中文(简体)
How to fill-in two input[text] in an HTML form using a barcode reader?
原标题:

I have a web page with one input text for the barcode content and a select for the barcode type.

So using the database, it is possible to generate the barcode in the good format.

A normal final user don t know which barcode as which type, but the barcode reader knows and can send this type as a keyboard input.

The problem is that I don t know how to change from the input to the select.

If I use, the , it prints a tabulation in the input instead of switching from a input to the other. If I use a it submit the form.

Do you have any idea of how I can do it so that my form can be use with or without the barcode reader?

It could print the barcode followed with the barcode type 6931442700194|EAN13 and split the content when processing the form but is there another solution?

最佳回答

You can use some Javascript and the onchange event (or some similar event) to detect the value of your input text has been changed (by your barcode reader). Then you get this value and split it over your input text and select.

<input type= text  id= inputtext  onchange= splitValue();  />
<select id= myselect >...</select>

And the JavaScript

function splitValue()
{
    var input=document.getElementById( inputtext );
    var select=document.getElementById( myselect );
    var test = input.value;

    // Perform some splitting and formatting

    input.value = splitted_inputvalue;
    select.value = splitted_selectvalue;
}
问题回答

暂无回答




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签