1、只是不能输入空格 代码如下:<input type=”text” onkeyup=”this.value=this.value.replace(/^ +| +$/g,”)”>2、不能输入空格及英文状态下的逗号 代码如下: <input type=”text” onkeyup=”this.value=this.value.replace(/[, ]/g,”)”>3、 代码如下:[removed] function myfunction() { var a = $(“text1”).val();