Exemplos como: abaixo:
Copie o código do código da seguinte forma:
<!
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv = "content-type" content = "text /html; charset = gb2312" /> />
<Título> Código de verificação JS </ititle>
<Style type = "text/css">
.código
{{
Imagem de fundo: URL (code.jpg);
Fonte-família: Arial;
Estilo de fonte: itálico;
Cor: vermelho;
borda: 0;
preenchimento: 2px 3px;
Espacamento de cartas: 3px;
Peso da fonte: mais ousado;
}
.UNUNDOUNDED
{{
borda: 0;
}
</style>
<Script Language = "Javascript" type = "text/javascript">
Código var;
Função createCode ()
{{
code = "";
Var codength = 4;
var checkCode = document.getElementById ("CheckCode");
var selectchar = nova matriz (0,1,2,3,4,5,6,7,8,9, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's , 's,' s 't', 'u', 'v', 'ww', 'x', 'y', 'z'); Você também pode usar chinês em chinês
for (var i = 0; i <codngth; i ++)
{{
var charindex = math.floor (math.random ()*36);
código += selectChar [Charindex];
}
// alert (código);
if (código de seleção)
{{
Checkcode.className = "Code";
Checkcode.value = code;
}
}
Valor da função ()
{{
var inputCode = document.getElementById ("input1").
if (inputCode.length <= 0)
{{
alerta ("Por favor, insira o código de verificação!");
}
else if (inputCode! = code)
{{
alerta ("Erro de entrada do código de verificação!");
createCode ();
}
outro
{{
alerta ("ok");
}
}
</script>
</head>
<body somente = "createCode ()" >>
<form ação = "#">
<input type = "text" id = "input1" />
<input type = "text" onclick = "createCode ()" readOnly = "readonly" id = "checkcode" /> <r />
<input id = "Button1" OnClick = "validate ();" Type = "Button" Value = "OK" /> /> />
</morm>
</body>
</html>