1
I need to take the data of an input and pass to a box! I have a Cod that takes the dice from a combo to play in a box!
Cod:
function move(Origem, Destino)
{
var opt = document.createElement("option");
for(i = 0; i < Origem.options.length; i++)
{
if (Origem.options[i].selected && Origem.options[i].value != "")
{
if(w_seq_qtde[Origem.options[i].value]==0)
alert("sem periférico no estoque!");
else
{
document.getElementById("cb_MenuDestino").options.add(opt);
opt.text = Origem.options[i].text;
opt.value = Origem.options[i].value;
w_seq_qtde[Origem.options[i].value]--;
}
}
}
}
input:
<input type="text" name="tx_MenuOrigem" value="">
button :
<input type="button" onClick="move(this.form.tx_MenuOrigem,this.form.cb_MenuDestino)" value="+++">
select:
<select multiple size="7" name="cb_MenuDestino" style="width:300"></select>
In this case when selecting the item in the combo and pressing on a button to add it plays in the box! But I want to take the dice in an input and play inside the box! If possible has to be more or less similar for better understanding?! Thanks to those who help!
I want to block if the data is the same as entered, as I do?
– Alexandre
Can you explain how your answer solves the problem?
– Sergio
Function Jaexiste(Destination, value) { for(i = 0; i < Destination.options.length; i++) { if (Destination.options[i].value == value) Return true; } Return false; } &#Function moves(input, Destination) { var opt = Document.createelement("option"); var value = input.value; if(value==""|| Jaexiste(Destination,value)) Return; if(value==0) { Alert("without peripheral in stock!"); turn; } opt.text = value; opt.value = value ; Target.options.add(opt); }
– GustavoGag