随机验证码

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
function fun1(){
var m="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
var str="";
for(var i=0;i<4;i++){
var x=Math.random()*62;
var y=Math.floor(x);
str+=m[y]
}
document.getElementById("yzhm").innerHTML=str;

}
</script>
</head>

<body onload="fun1()">
<div id="yzhm"></div>
<input type="button" onclick="fun1()" value="刷新"/>
</body>
</html>

posted @ 2014-05-14 16:14  小美工的碎碎念  Views(298)  Comments(0)    收藏  举报