Hola
x_women
Tu segundo código me ha dado una idea, a ver si te sirve:
Código PHP:
<html>
<head>
<script>
function VerificarNumero(e){
tecla = (document.all) ? e.keyCode : e.which;
if (tecla==8) return true;
num = parseInt(document.forms[0]['vf_opcionmultiple'].value)-1;
patron = new RegExp('[0-' + num +']');
te = String.fromCharCode(tecla);
return patron.test(te);
}
</script>
</head>
<body>
<form>
<input name="vf_opcionmultiple" type="text" value="5" size="5" maxlength="5" readonly="readonly" />
<input name="vf_cantidad" type="text" size="5" maxlength="5" onKeyPress="return VerificarNumero(event)" />
</form>
</body>
</html>
Saludos,