機能createGuid(){ // 进制转换X = 10/16/2月8日 のvar進= 関数(NUM、X、Y){ 場合(Y!= 不定){ リターンのparseInt(num.toString()、Y) .toString(X)。 } 他{ 戻りのparseInt(num.toString())のtoString(X)。 } }。 // 补零 VAR addZero = 関数(NUM){ 場合(番号(NUM).toString()= 'はNaN' && NUM> = 0 && NUM <10!){ リターン '0' + Math.floor(NUM)。 } 他{ 戻る)(num.toStringします。 } }。 // 年月日 VAR getGUIDDate = 機能(日付){ リターン( date.getFullYear() + ' - ' + addZero(date.getMonth() + 1)+ ' - ' + addZero(date.getDay()) )。 }。 // 时分秒 VAR getGUIDTime = 機能(日付){ リターン( addZero(date.getHours()) + ':' + addZero(date.getMinutes()) + ':' + addZero(date.getSeconds()) )。 }。 VAR日付= 新しい日付(); VAR guidStr =進(getGUIDDate(日付)、16 )。 返すguidStrを。 }