0
有誰知道如何爲Internet Explorer生成UUID/GUID?JavaScript:如何爲Internet Explorer 9生成UUID?
我有代碼Broofa在:http://www.broofa.com/2008/09/javascript-uuid-function/
這在幾乎所有的瀏覽器工作正常,除了IE 9
有誰知道如何爲Internet Explorer生成UUID/GUID?JavaScript:如何爲Internet Explorer 9生成UUID?
我有代碼Broofa在:http://www.broofa.com/2008/09/javascript-uuid-function/
這在幾乎所有的瀏覽器工作正常,除了IE 9
這是我要做的事:
window.Guid = function() {
function part() {
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1).toUpperCase();
};
return {
NewGuid: function() { return (part() + part() + "-" + part() + "-" + part() + "-" + part() + "-" + part() + part() + part()); },
Empty: "00000000-0000-0000-0000-000000000000"
};
}();
現在你可以做:
Guid.NewGuid(); // new uuid
Guid.Empty; // empty uuid
我這樣做:alert(「uuid:」+ _ f);它顯示爲undefined! – Edge
我在這裏找到了解決方案:http://note19.com/2007/05/27/javascript-guid-generator/ – Edge