Why can you enter +-when the input type is number? These characters

<input type="number" pattern="[0-9]*" placeholder="" autocomplete="off">

what is the cause of this problem? How to solve it?
question picture:

clipboard.png

clipboard.png

clipboard.png

Dec.23,2021

enter a positive integer greater than 0

the code is as follows:

< input onkeyup= "if (this.value.length==1) {this.value=this.value.replace (/ < sup id=" fnref-1 "> 1 < / sup > / g else')} else {this.value=this.value.replace (/ Dramp g else')}" onafterpaste= "if (this.value.length==1) {this.value=this.value.replace (/ < sup id=" fnref-1 "> 1 < / sup > / g, '')} else {this.value=this.value.replace (/ DCMG recording')} ">

1, the text box can only enter numeric codes (nor can decimal points)

the code is as follows:

< input onkeyup= "this.value=this.value.replace (/ DAccord gpencil')" onafterpaste= "this.value=this.value.replace (/ DAccord gpencil')" >

2, you can only enter numbers and can enter decimal points.

the code is as follows:

< input onkeyup= "if (isNaN (value)) execCommand ('undo')" onafterpaste= "if (isNaN (value)) execCommand (' undo') >
< input name=txt1 onchange=" if (/ D/.test (this.value)) {alert ('only numbers can be entered'); this.value='';} ">

3, number and decimal point method two

the code is as follows:
< input type=text tasking value = "" onkeypress= "if (! this.value.match (/ ^ [+ -]? d ?. D ? $/)) this.value=this.t_value;else this.t_value=this.value; If (this.value.match (/ ^: [\ +\ -]?\ d + (?:\.\ d+)?)) this.o_value=this.value "onkeyup=" if (! this.value.match (/ ^ [+ -]? d ?. D ? $/)) this.value=this.t_value;else this.t_value=this.value; If (this.value.match (/ ^: [\ +\ -]?\ d + (?:\.\ d +)?)) this.o_value=this.value "onblur=" if (! this.value.match (/ ^ (: [+ -]? d +)? | .d *?)? $/)) this.value=this.o_value;else {if (/ ^\.\ dcards /)) this.value=0+this.value; If (this.value.match (/ ^. $/)) this.value=0;this.o_value=this.value} ">

< hr >
    < li id= "fn-1" > 1-9 please

you can only write one function to match input values to form a response
delete if it does not meet your input requirements to achieve the effect of not allowing other characters to be entered
because the number type allows you to enter +-/ *. these

Menu