paul_cheung

导航

javascript generate a guid

  

        function Guid() {
            var random = (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
            return random;
        };

        function GenerateGUID() {
            var guid = (Guid() + Guid() + "-" + Guid() + "-" + Guid() + "-" + Guid() + "-" + Guid() + Guid() + Guid()).toUpperCase();
            return guid;
        };
       
        var newId = GenerateGUID();

 

posted on 2014-04-08 17:59  paul_cheung  阅读(315)  评论(0编辑  收藏  举报