[Original] Using JavaScript check user input length in Japanese system

xiaoxiao2021-03-06  50

OF: bluesky35 (blue) under the following JavaScript user input check function fvallenchk Japanese environment can be called directly, for the object obj to be verified, max_len the maximum length, the function returns 0 represents the length is exceeded, and vice versa by .function fgetdata (OBJ) {wkvalue = ""; wktype = obj.type; if (wktype == "text") {wkvalue = obj.value;} else = = "hidden" {wkvalue = obj.value;} Else if (wktype == "select-one") {sell = obj.selectedIndIndex; wkvalue = Obj.Options [sell] .value;} else if (wktype == "textarea) {wkvalue = obj.value;} else IF (wktype == "password") {wkvalue = obj.value;} Return WKValue;}

Function Fvallenchk (Obj, Max_Len) {var Chkstr, I, CNT = 0;

CHKSTR = "ア ウエオ ウエオ キ キ ゙゚ ナ ケコサシ ケコサシ ヨ ヨ チ チ レ ナ ヌネノハヒフヘホマミム ヌネノハヒフヘホマミム ヨ ヨ リ レ レ レ ワ ワ ヲ ヨ ァィゥェォ ャュョ レ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (Escape (Strvalue.Charat (I)). Length> = 4) {if (chkstr.indexof (StrvaluE.Charat (i)) == -1) {CNT = 2;} else {CNT ;}} else {CNT }}; If (cnt> max_len) {return "0";} else {return "1";}}

转载请注明原文地址:https://www.9cbs.com/read-113859.html

New Post(0)