<html>
<head>
<title>测试编码</title>
<script>
function doEncode(){
var con = document.getElementById("content");
con.value = encodeURIComponent(con);
alert(con.value);
}
function doDecode(){
var con = document.getElementById("content");
con.value = decodeURIComponent(con);
alert(con.value[0]);
}
function newGuid()
{
var guid = "";
for (var i = 1; i <= 32; i++){
var n = Math.floor(Math.random()*16.0).toString(16);
guid +=n;
}
alert(guid.toUpperCase());
guid += new Date().getTime();
alert(guid.toUpperCase());
return guid.toUpperCase();
}
function toNewGuid(){
alert(newGuid());
}
</script>
</head>
<body>
<input type="text" id="content"/><br/>
<input type="button" οnclick="doEncode()" value="Encode"/>
<input type="button" οnclick="doDecode()" value="Decode"/>
<input type="button" οnclick="toNewGuid()" value="GUID"/>
</body>
</html>