I have a page with a textbox where a user is supposed to enter a 24 character (letters and numbers, case insensitive) registration code.(我有一个带有文本框的页面,用户应在其中输入24个字符(字母和数字,不区分大小写)的注册码。)
I used maxlength
to limit the user to entering 24 characters.(我使用maxlength
将用户限制为输入24个字符。)
The registration codes are typically given as groups of characters separated by dashes, but I would like for the user to enter the codes without the dashes.(注册代码通常以破折号分隔的字符组形式给出,但是我希望用户输入不带破折号的代码。)
How can I write my JavaScript code without jQuery to check that a given string that the user inputs does not contain dashes, or better yet, only contains alphanumeric characters?(如何在没有jQuery的情况下编写我的JavaScript代码,以检查用户输入的给定字符串不包含破折号,或者更好的是,仅包含字母数字字符?)
ask by Daniel Allen Langdon translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…