内联JavaScript验证不起作用

内联JavaScript验证不起作用,javascript,html,inline,Javascript,Html,Inline,我尝试验证一些类似的输入。但这不起作用。不使用外部JS或外部方法的正确方法是什么… <input type='number' class='form-control input-sm' onkeypress="return this.value < = 100;"> 使用onkeyup代替keypress <input type='number' class='form-control input-sm' onkeyup="this.value =(this.valu

我尝试验证一些类似的输入。但这不起作用。不使用外部JS或外部方法的正确方法是什么…

<input type='number' class='form-control input-sm' onkeypress="return this.value < = 100;">

使用
onkeyup
代替
keypress

<input type='number' class='form-control input-sm'
 onkeyup="this.value =(this.value <= 100) ? this.value : '';">


使用
max
attribute(),但这工作正常。!以上代码不工作!根据我的问题,无法使用max属性!