JS 判断用户输入,必须为“数字”或者“-”用正则控制用户只能输入数字来的更方便,给你个例子:<input type="text" onkeyup="this.value=this.value.replace([^d-]g,'2023-03-14JavaScript220