Today, when I was writing JavaScript, I encountered an error. The JS Code is as follows:
// Verify the regular expression of the date format. For example
Function isdate (STR )...{
VaR days = new array (, 31 );
VaR A = Str. match (/^ (d... {4}) (-) (d... {1, 2}) (-) (d... {1, 2}) $ /);
If (A = NULL) return false;
Days [1] = (0 = A [1] % 4) & (0! = (A [1] % 100) | (0 = A [1] % 400 )? 29:28;
If (A [1] <= 1900 | A [3] = 0 | A [3]> = 13 | A [5] = 0 | [5]> days [A [3]-1])
Return false;
Return true;
}
Function edittime ()...{
VaR startdate = Document. getelementbyid ("meetstartdate ");
VaR enddate = Document. getelementbyid ("meetenddate ");
If (! Isdate (startdate. value. Trim ()))
...{
Alert ('<Bean: Message key = "label. editmeettime. starttime "/> '+'' +' <Bean: Message key = "MSG. meetboard. startdateiserror "/> ');
Startdate. Focus ();
Return;
}
If (! Isdate (enddate. value. Trim ()))
...{
Alert ('<Bean: Message key = "label. editmeettime. endtime "/> '+'' +' <Bean: Message key = "MSG. meetboard. startdateiserror "/> ');
Enddate. Focus ();
Return;
}
Editmeettimeform. Action = 'savemeettime. Do ';
Editmeettimeform. Submit ();
Window. opener. Location = 'meetboard. do? Meetingid = '+' <Bean: write name = "editmeettimeform" property = "meetdetailid"/> ';
Window. Close ();
}
The yellow flag is incorrect. This attribute is not supported. After removing trim (), that's right. I remember using this method before, and no error was reported. After checking the pages that previously supported trim, we found that it would be okay to import Ajax-related JavaScript on the pages, as shown below:
<SCRIPT type = "text/JavaScript" src = "JS/ajaxtags/ajaxtags-1.2-beta2.js"> </SCRIPT>
I searched trim in this JS and found a method like this:
String. Prototype. Trim = function ()...{
Return this. Replace (/(^ s *) | (S * $)/g ,"");
}
So I removed the JS imported above, and added this method only. OK. I still don't know why. I'll try again later.
Recently, I feel like I am using JavaScript ......