I gather the client to develop classic JavaScript methods, I hope you have added!
1. String alternative method. function String_Replace (srcString, findString, replaceString) {return String_ReplaceB (srcString, findString, replaceString, 0);} function String_ReplaceB (expression, find, replacewith, start) {var index = expression.indexOf (find, start); if (index == -1) Return Expression;
Var Findlen = Find.Length; var newexp = ""; newexp = expression.substring (0, index) (Expression.Substring (INDEX FINDLEN));
Return string_replaceb (newExp, find, replacewith, index 1 findlen);
2. Take a string length method function string_getlength (str) {var i, rt = 0; for (i = 0; i
3. Floating point method Function getFloat (NUM) {var Num = parsefloat (NUM); if (isnan (NUM)) NUM = 0; Return Num;}
4. Seeking a plural method (used to floating point number) Function GetInt (NUM) {Return Parseint (Getfloat (NUM));
5. Judging whether the text domain object is only empty function at_checkblank (obj, caption) {if (string_replace (obj.value, "," ") ==" ") {obj.select (); Alert (CAPTION " cannot be empty. " ); Obj.focus (); return false;} return true;}
6. Two SELECT objects (LLIST, RLIST) Operate VAR LLIST = FMOBJ.AssignedUser; // The item VAR rlist = fmobj.waITEDUser; // On the right side Unselected item / / Double-click the item in the right SELECT Function AssignUser ) {If (rlist.selectedindex <0 || rlist.selected "RList.Options.Length) Return; Var i;
Llist.Options.LENGTH ; llist.Options [llist.Options.Length-1] .value = rlist.Options [rlist.selectedIndIndex] .value; llist.Options [llist.Options.Length-1] .text = rlist.Options [rlist.selectedindex] .TEXT;
For (i = rlist.selectedindex; i
For (var j = i; j