First of all, I'm sorry, I'm new to programming and I know that the following code has errors. The idea of this code is that the user selects a Select option, each one has a maximum value. After that the user must enter in an input number a numeric value, which should not be greater than the option you selected previously (there the scripts should prevent you from entering a larger number). The correct code should look something like this:
function cboc(){
var maxvalGORE = parseInt("0");
if(cb == 0){
maxvalGORE = 0;
if(cb == 15){
maxvalGORE = 100;
}
if(cb == 16){
maxvalGORE = 200;
}
}
}
function cbocc(){
var val = null;
var x = document.GetElementById('txtprepos').value;
val = parseInt(x);
if(val > maxvalGORE){
alert('El valor es más alto que $' + maxvalGORE +'.');
document.GetElementById('txtprepos').value = "";
}
}
<select style="width=5.5em;" name="cbotipfon" id="cbotipfon" onchange="cboc()">
<option value="0">Seleccione</option>
<option value="15">Opción A</option>
<option value="16">Opción B</option>
</select>
<input type="number" onblur="cbocc()" name="txtprepos" id="txtprepos">
If you could help me, I would be eternally grateful. Thanks in advance and for taking the trouble to read.