JavaScript代码
1 function myGuid() { 2 var guid = function() { 3 return (((1+Math.random())*0x10000)|0).toString(16).substring(1); 4 }; 5 return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4()); 6 } 7 function CGUI(){ 9 document.getElementById("GUIDshow").innerHTML=myGuid(); 10 }
Html代码
1 <p>唯一的GUID</P> 2 <input type="button" onclick="GUID()" value="点我生成唯一的GUID"/>