1. Cancel the dashed box when the button is pressed, add the attribute value in input hidefocus or hidefocus=true<inputtype= "Submit"value= "Submit"Hidefocus= "true" />2. Read-only text box contents, add attribute value in input readonly<inputtype= "text"ReadOnly/>3. Prevent the text document from being emptied (you can use the style content as a class reference)<inputtype= "text"style= "Behavior:url (#default #savehistory);" />4.ENTER Key to move the cursor to the next input box<inputtype= "text"onkeydown= "if (event.keycode==13) event.keycode=9" />5. Only Chinese (with flashing)<inputtype= "text"onkeyup= "Value=value.replace (/[-~]/g, ')"onkeydown= "if (event.keycode==13) event.keycode=9" />6. Only digital (with flashing)<inputtype= "text"onkeyup= "Value=value.replace (/[^\d]/g, ')"Onbeforepaste= "Clipboarddata.setdata (' text ', Clipboarddata.getdata (' text ')." Replace (/[^\d]/g, ")" />7. Only digital (no flashing)<inputtype= "text"style= "ime-mode:disabled"onkeydown= "if (event.keycode==13) event.keycode=9"onkeypress= "if ((event.keycode<48 | | event.keycode>57)) event.returnvalue=false" />8. Only input English and numerals (with flashing)<inputtype= "text"onkeyup= "Value=value.replace (/[\w]/g, ')"Onbeforepaste= "Clipboarddata.setdata (' text ', Clipboarddata.getdata (' text ')." Replace (/[^\d]/g, ")" />9. Shielding Input Method<inputtype= "text"name= "url"style= "ime-mode:disabled"onkeydown= "if (event.keycode==13) event.keycode=9" />10. Enter only digits, decimal point, minus (-) character (no flashing)<inputonkeypress= "If" (event.keycode!=46 && event.keycode!=45 && (event.keycode<48 | | event.keycode>57)) Event.returnvalue=false " />11. Only two decimal places can be entered, three decimal places (with flashing)<inputtype= "text"maxlength= "9"onkeyup= "if (Value.match (/^\d{3}$/)) Value=value.replace (Value,parseint (VALUE/10)); Value=value.replace (/\.\d*\./g, ' . ') 'onkeypress= "if ((event.keycode<48 | | event.keycode>57) && event.keycode!=46 && event.keycode!=45 | | Value.match (/^\d{3}$/) | | /\.\d{3}$/.test (value)) {Event.returnvalue=false} " />12. Only numbers and decimal points can be entered<inputtype= "text"size= " a"onkeyup= "This.value=this.value.replace (/[^\d\.) +?/g, ")" />13. You can only enter numbers and English<inputonkeyup= "Value=value.replace (/[\w]/g, ')"Onbeforepaste= "Clipboarddata.setdata (' text ', Clipboarddata.getdata (' text ')." Replace (/[^\d]/g, ")">14. You can only enter a number<inputonkeyup= "Value=value.replace (/[^\d]/g, ')"Onbeforepaste= "Clipboarddata.setdata (' text ', Clipboarddata.getdata (' text ')." Replace (/[^\d]/g, ")">15. Only full-width input<inputonkeyup= "Value=value.replace (/[^\uff00-\uffff]/g, ')"Onbeforepaste= "Clipboarddata.setdata (' text ', Clipboarddata.getdata (' text ')." Replace (/[^\uff00-\uffff]/g, ")">16. Only input characters<inputonkeyup= "Value=value.replace (/[^\u4e00-\u9fa5]/g, ')"Onbeforepaste= "Clipboarddata.setdata (' text ', Clipboarddata.getdata (' text ')." Replace (/[^\u4e00-\u9fa5]/g, ")">
JS Limit input Input