As easy as that :)
// Generate new Guid
function Hexa4()
{
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
}
function GenerateGuid()
{
return (Hexa4()+Hexa4()+"-"+Hexa4()+"-"+Hexa4()+"-"+Hexa4()+"-"+Hexa4()+Hexa4()+Hexa4()).toUpperCase();
}
// USE
var guid = GenerateGuid();
alert(guid);
Wednesday, January 26, 2011
Generate a new Guid in JavaScript
Subscribe to:
Post Comments (Atom)
0 comentarii:
Post a Comment