<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title></title> </head> <script> function uuid() { var s = []; var hexDigits = "0123456789abcdefghijklmnopq"; for (var i = 0; i < 6; i++) { s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1); } var uuid = s.join(""); document.getElementById("ic").value=uuid; } function MathRand() { var Num=""; for(var i=0;i<6;i++) { Num+=Math.floor(Math.random()*10); } document.getElementById("ic").value=Num; } function createInviteCode() { var randomChar = Math.random().toString(16).substr(9); document.getElementById("ic").value=randomChar; } </script> <body> <div> <input id="ic" type="text"/> <input id="yqmYqm" class="yqm" type="button" value="生成邀请码1" onclick="MathRand()"/> <input id="yqmYqm" class="yqm" type="button" value="生成邀请码2" onclick="uuid()"/> <input id="yqmYqm" class="yqm" type="button" value="生成邀请码3" onclick="createInviteCode()"/> </div> </body> </html>
时间: 2024-10-24 23:04:11